最新的工作主要集中在了微信企业号方面,近期困扰的主要的问题中文消息的问题,发现使用python回复消息最多只能回复9个中文。后来反复测试发现原来是Unicode和str的问题,在返回消息时需要将json转换为str
tempstr='''
{
"userid": "{{userid}}",
"name": "{{name}}",
"department": [{{department}}],
"gender": "{{gender}}",
"weixinid": "{{weixinid}}",
"position": "{{position}}"
}
'''
userData={}
userData['userid']=shoujihao
userData['name']=name
userData['weixinid']=weixinhao
userData['department']=[bid]
userData['position']=danwei
userData['gender']=int(xingbei)+1
t=Template(tempstr)
c=Context(userData)
rs=t.render(c)
rs=str(rs)
return rs
网友评论