加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

TypeError: not a valid non-string sequence or mapping ob

(2013-04-26 14:26:10)
标签:

it

分类: python
python字典格式的字符串,编码异常解决
>>> diction = {'bk': "['bookprice_41_64030']"}
>>> urllib.urlencode(str(diction))
Traceback (most recent call last):
  File "", line 1, in
  File "c:\Python27\lib\urllib.py", line 1312, in urlencode
    raise TypeError
TypeError: not a valid non-string sequence or mapping object
>>> urllib.quote_plus(str(diction))
'{'bk':+"['bookprice_41_64030']"}'
>>>

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有