每个人,我都试着用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)出了问题,我怎么解决呢?谢谢
发布于 2016-06-20 07:54:20
我想你忘了保存它来改变变量。
textcontent = textcontent.decode('utf8').encode('big5')
https://stackoverflow.com/questions/37917142
复制相似问题