每一个,我尝试用python发送短信,我可以发送,但是我需要用中文发送,这是big5,我必须将utf8解码成big5,这是我的sms python代码
trydecode.py
import urllib
import urllib2
def sendsms(phonenumber,textcontent):
textcontent.decode('utf8').encode('big5')
url = "https://url?username=myname&password=mypassword&dstaddr="+phonenumber+"&smbody="+textcontent
req = urllib2.Request(url)
response = urllib2.urlopen(req)
这个代码(python2.7)我可以用英文发短信,但中文(big5)有问题,我该怎么解决?谢谢你
我想你忘了保存它来改变变量。在
textcontent = textcontent.decode('utf8').encode('big5')
相关问题 更多 >
编程相关推荐