上一页 1 ··· 3 4 5 6 7
摘要: 1:对元素进行遍历[root@80sa python]# cat test.py #!/usr/bin/env python#coding:utf-8for x in "jesse": print x[root@80sa python]# python test.py jesse2:对列表进行遍历[root@80sa python]# cat test.py #!/usr/bin/env python#coding:utf-8list = ["jesse","elain","zcl"]for x in range( 阅读全文
posted @ 2013-06-25 23:53 study-notes 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 最近学习Python核心编程(第二版)第52页代码中有部分错误,在纠错的同时也进行了一些优化完善处理,初学Python不足之处,请大家多多指教。相关代码如下: 1 [root@CentOS-6 ~]# cat maketextfile.py 2 3 #!/usr/bin/env python 4 #coding:utf-8 5 6 import os 7 import time 8 import sys 9 fname = 'write.log'10 ls = os.linesep11 while True:12 if os.path.exists(fname):13 ... 阅读全文
posted @ 2013-06-16 00:57 study-notes 阅读(190) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7