ฉันกำลังพยายามสร้างโมดูล python สำหรับ jenni/penny irc bot
นี่เป็นส่วนหนึ่งของรหัสของฉัน
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)
หากอินพุตเป็น str
อยู่แล้ว เหตุใดฉันจึงได้รับข้อผิดพลาดนี้
AttributeError: วัตถุ 'str' ไม่มีแอตทริบิวต์ 'isstr'
str
คุณจะรู้ว่าเป็นisstr
คุณไม่จำเป็นต้องมีวิธีในการทำเช่นนั้น - person tripleee   schedule 28.09.2012