所以我想写这个:
pMessage = message.content.replace('!createpoll ', '')
newP = pMessage.split()
countforpoll = 0
for p in newP:
if countforpoll == 0:
countforpoll = 1
pollName = p
elif ('END' == p) == False:
try:
with open("poll.txt",'a') as f:
f.write(str(p +' 0\n'))
except EnvironmentError as e:
print("Error:", e)
但它根本没有写入空文本文件
!createpoll
具有格式
!createpoll (name of poll) (as many options) (END to let the program know youre finished)
message.content
是一个包含个人信息的字符串。