Crossin的编程教室

标题: 求助!!!! [打印本页]

作者: lilong    时间: 2013-9-14 19:41
标题: 求助!!!!
求助:
查天气那个小程序出现下面的问题:
城市乱码:
060307|101060307
榫欎簳:101060307
060308|101060308
鐝叉槬:101060308
060309|101060309
鍥句滑:101060309
结果显示有误:
Traceback (most recent call last):
  File "D:/python/city.py", line 27, in <module>
    code = content4.split('|')[1]
IndexError: list index out of range

作者: crossin先生    时间: 2013-9-16 01:23
乱码问题: print content.decode('utf-8')
第二个问题应该是因为网络问题,有时候对方服务器没能成功返回结果。

可以参考 查天气4 里面的讨论

作者: lilong    时间: 2013-10-28 10:46
crossin先生 发表于 2013-9-16 01:23
乱码问题: print content.decode('utf-8')
第二个问题应该是因为网络问题,有时候对方服务器没能成功返回 ...

谢谢您!!!




欢迎光临 Crossin的编程教室 (https://bbs.crossincode.com/) Powered by Discuz! X2.5