对python的isinstance的认识
>>> class objA:
... pass
...
>>> A = objA()
>>> B = 'a','V'
>>> B
('a', 'V')
>>> C = 'a string'
>>> print instance(A,objA)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'instance' is not defined
>>> print isinstance(A,objA)
True
>>> print isinstance(B,tuple)
True
>>> print isinstance(C,tuple)
False
>>> print isinstance(C,string)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'string' is not defined
>>> print isinstance(C,basestring)
True
>>>
相关文档:
一般安装的都是Python22版,wincvs1.3需要python2.1版本及以上。但是启动过程找不到,网上搜索的方法不大适用。最后经过试验发现,把Python22安装路径下的python22.dll拷贝到wincvs的安装目录下。运行wincvs,ok。觉得这个方法好用的给顶下! ......
下面这个小工具包含了 判断unicode是否是汉字,数字,英文,或者其他字符。 全角符号转半角符号。 unicode字符串归一化等工作。 还有一个能处理多音字的汉字转拼音的程序,还在整理中。
#!/usr/bin/env python
# -*- coding:GBK -*-
"""汉字处理的工具:
判断unicode是否是汉字,数字,英 ......
作者:taowen, billrice
http://www.cnblogs.com/taowen/articles/11239.html
Lesson 1 准备好学习Python的环境
下载的地址是:
www.python.org
为了大家的方便,我在校内作了copy:
http://10.1.204.2/tool/compiler&IDE/Python-2.3.2-1.exe
linux版本的我就不说了,因为如果你能够使用linux并安装好说明你可以 ......
这篇文章讲得比较清楚python的字符串编码问题
原文出处:http://hi.baidu.com/yobin/blog/item/894158b575090dcb37d3ca07.html
------------------------------------------------------------------
字符串编码
python中默认编码是ASCII,可以通过以下方式设置和获取:
import sys
print sys.getdefa ......