Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2107954
  • 博文数量: 333
  • 博客积分: 10161
  • 博客等级: 上将
  • 技术积分: 5238
  • 用 户 组: 普通用户
  • 注册时间: 2008-02-19 08:59
文章分类

全部博文(333)

文章存档

2017年(10)

2014年(2)

2013年(57)

2012年(64)

2011年(76)

2010年(84)

2009年(3)

2008年(37)

发布时间:2014-01-06 13:10:32

 python with用法python中with可以明显改进代码友好度,比如:[python] view plaincopyprint?with open('a.txt') as f:      print f.readlines()  .........【阅读全文】

阅读(4349) | 评论(0) | 转发(0)

发布时间:2013-12-23 09:18:31

isinstance    isinstance(object, classinfo)   判断实例是否是这个类或者object是变量    classinfo 是类型(tuple,dict,int,float)  判断变量是否是这个类型 &n.........【阅读全文】

阅读(3230) | 评论(0) | 转发(2)

发布时间:2013-12-23 09:11:11

1.命令介绍最近学习并使用了一个python的内置函数dir,首先help一下:>>> help(dir)Help on built-in function dir in module __builtin__:dir()    dir([object]) -> list of strings    Return.........【阅读全文】

阅读(1257) | 评论(0) | 转发(0)

发布时间:2013-12-23 09:02:23

getattr()函数是Python自省的核心函数,具体使用大体如下:10.1.5    获取对象引用getattrGetattr用于返回一个对象属性,或者方法Python代码class A:       def __init__(self):    &nbs.........【阅读全文】

阅读(1365) | 评论(0) | 转发(0)

发布时间:2013-12-22 20:09:43

list函数:将字符串转化成列表,例:[html] view plaincopy>>> name = list('hello')  >>> name  ['h', 'e', 'l', 'l', 'o']  .........【阅读全文】

阅读(1214) | 评论(0) | 转发(0)
给主人留下些什么吧!~~

chinaunix网友2011-01-18 17:32

如果有Python写作的兴趣,可以联系我。QQ:49729348

回复 |  删除 |  举报

chinaunix网友2011-01-18 17:31

您好。我是一家出版社的编辑,你接触Python多长时间了。

回复 |  删除 |  举报
留言热议
请登录后留言。

登录 注册