易截截图软件、单文件、免安装、纯绿色、仅160KB

对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
>>>


相关文档:

深入 GalCon:Python、游戏开发和人工智能

Alex. J. Champandard
赖勇浩(http://laiyonghao.com) 译
原文地址:http://aigamedev.com/open/interviews/inside-galcon-python-ai/
AiGameDev.com在这个周一的 pratical insights 是对Phil Hassey采访。Phil 是一个独立游戏开发者,也是游戏产业社区的活跃分子。他曾赢得2006年4月的 Ludum Dare 比赛(这个比赛关注 ......

Python 字符串方法


 
Python-String-Function
字符串中字符大小写的变换:
    * S.lower()   #小写
    * S.upper()   #大写
    * S.swapcase()   #大小写互换
    * S.capitalize()   #首字母大写
&n ......

python 中文乱码 问题深入分析

 
转自:http://hi.baidu.com/%C1%EE%BA%FC%CF%F3/blog/item/efb76fb7f0411dc437d3ca20.html
 
在本文中,以'哈'来解释作示例解释所有的问题,“哈”的各种编码如下:
  1. UNICODE (UTF8-16),C854;
  2. UTF-8,E59388;
  3. GBK,B9FE。
一、python中 ......

Python的串口通讯第三方库PySerial

 最近要用到串口通讯,简单易用的Python又帮上忙了,多亏了庞大的第三方资源~~~ :)
pySerial
Overview
This module encapsulates the access for the serial port. It provides
backends for Python running on Windows, Linux, BSD (possibly any POSIX
compliant system), Jython and IronPython (.NET and M ......

Python 字符串方法详解


类型
方法
注解
填充
center(width[, fillchar]) ,
ljust(width[, fillchar]),
rjust(width[, fillchar]),
zfill(width),
expandtabs([tabsize])
l        
fillchar 参数指定了用以填充的字符,默认为空格
l        
顾 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号