I am trying to make python module for jenni/phenny irc bot.
This is part of my code
def bp(jenni, input):
try:
text = input.group(2).encode('utf-8').split()
except:
jenni.reply("Please use correct syntax '.bp id weapons 7'. Available for weapons and food only")
if text[0].isstr() and text[1].isstr() and text[2].isdigit() and len(text) == 3 and text[1] == ('weapons' or 'food'):
url = 'http://someAPIurl/%s/%s/%s/1.xml?key=%s' % (text[0], text[1], text[2], key)
If the input is already a str why would I be getting this error?
AttributeError: ‘str’ object has no attribute ‘isstr’
The error is exactly what it says;
strhas no methodisstr().If you want to make sure that it’s only letter(s), use
.isalpha().Example: