2016年10月14日

python: int to unicode string

摘要: >>> import types >>> print type(str(2)) >>> print type(str('2')) # 这里先转为str,在转为unicode >>> print type(str(2).decode('utf-8')) >>> print type(str('32').decode('utf-8')) >>> print str(2).decode('utf... 阅读全文

posted @ 2016-10-14 19:36 ZhYQ_note 阅读(969) 评论(0) 推荐(0)

PyCharmIDE: 给脚本传递参数

摘要: 阅读全文

posted @ 2016-10-14 17:34 ZhYQ_note 阅读(1479) 评论(0) 推荐(0)

python: str()

摘要: tx1 = '中国' tx2 = u'中国' print tx1 print tx2 print type(tx1) print type(tx2)# str()函数会把unicode的字符串转成str形式的,使用的时候要注意print type(str(tx2)) 中国 中国 阅读全文

posted @ 2016-10-14 14:57 ZhYQ_note 阅读(197) 评论(0) 推荐(0)

python: isdigit int float 使用

摘要: >>> num1 = '2.0' >>> print num1.isdigit() False >>> num2 = '2' >>> print num2.isdigit() True >>> num3 = '-3' >>> print num3.isdigit() False >>> num4 = 阅读全文

posted @ 2016-10-14 14:12 ZhYQ_note 阅读(583) 评论(0) 推荐(0)

导航