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 阅读(938) 评论(0) 推荐(0) 编辑

PyCharmIDE: 给脚本传递参数

摘要: 阅读全文

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

Python 判断字符串是否为数字

摘要: 1、原文地址:http://www.runoob.com/python3/python3-check-is-number.html 2、原文地址:http://bbs.csdn.net/topics/370089561 阅读全文

posted @ 2016-10-14 17:04 ZhYQ_note 阅读(507) 评论(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 阅读(184) 评论(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 阅读(557) 评论(0) 推荐(0) 编辑

Python编程的中文问题

摘要: 原文地址:http://noalgo.info/578.html 字符编码问题是每个程序员必定会遇到的,同样,python的中文问题一直是一个非常令人头疼的问题,本文将介绍Python中涉及到中文细节问题。建议在阅读这篇文章之前,先前往字符编码详解这篇文章了解相关字符编码的原理细节。 str和Uni 阅读全文

posted @ 2016-10-14 13:53 ZhYQ_note 阅读(325) 评论(0) 推荐(0) 编辑

立即停止使用 setdefaultencoding('utf-8'), 以及为什么

摘要: 原文地址:http://blog.ernest.me/post/python-setdefaultencoding-unicode-bytes 立即停止使用 setdefaultencoding('utf-8'), 以及为什么 2016-02-01 python 编码 unicode 6136 最坏 阅读全文

posted @ 2016-10-14 10:47 ZhYQ_note 阅读(250) 评论(0) 推荐(0) 编辑

Python如何输出包含在对象中的中文字符?

摘要: 原文地址:https://www.zhihu.com/question/20413029 Python如何输出包含在对象中的中文字符? Python如何输出包含在对象中的中文字符? print [u'\u7ef3\u5b50', u'\u5e26\u5b50'][0] 可以正常输出其中一部分中文但是 阅读全文

posted @ 2016-10-14 10:40 ZhYQ_note 阅读(552) 评论(0) 推荐(0) 编辑

导航