admin管理员组文章数量:1435858
啄木鸟,python讲座,源码
这个是根据啄木鸟社区,一个python讲座,整理的python源码.
以备自查.
---------------------------------------
part1
# -*- coding : utf-8 -*-
#-------------------------------------------------------------------------------
# Name: 啄木鸟社区,某宣讲ppt,代码.
# Purpose:
#
# Author: huanghuan
#
# Created: 14-08-2013
# Copyright: (c) huanghuan 2013
# Licence: <your licence>
#-------------------------------------------------------------------------------import os
from os.path import join,getsize
import sysprint sys.argv[1]for root,dirs,files in os.walk(sys.argv[1]):if 'CVS' in dirs:fn = join(root+'\CVS','ROOT')print root + ' :', fnf = open(fn,'r')r = f.read()if r.startswitch('e:\cvsroot'):open(fn,'w').write('g:\cvsroot')f = open(fn,'r')r = f.read()print r#************** test code ********************t = (1,2,3)
print "type(t) = ", type(t)
print "t[1] = ", t[1]#----------
a = "hello"
print "a = ", a
#print a[0]
print "a[-1] = ", a[-1]#----------
b = list(a)
print "b = ", b
print "b[4:] = ", b[4:]
print "b[3:-1] = ", b[3:-1]b[1:2] = ['a','b','c']
print "b = ", b#-----------
d = dict(zip(b,range(len(b))))
print "d = ", d
print "d.keys() = ", d.keys()
print "d.items() = ", d.items()
--------------------------------------
转载于:
版权声明:本文标题:啄木鸟,python讲座,源码 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/biancheng/1702315483a576863.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论