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

Python入门的36个例子 之 26

源代码下载:下载地址在这里
# 029
aFile = file(r'C:\in.txt', 'r')
while True:
line = aFile.readline()
if len(line) == 0:
break
# end of if
print line,
# end of while
aFile.close()

output:
>>>
This is the first line.
This is the second line.
This is the third line.
>>>


相关文档:

Python Ascii to bcd bcd to Ascii

在网上搜不到关于 Ascii 和 bcd互相转化的文章,于是自己写了一个,和大家分享下。
没有考虑到效率,能够优化的地方望大家提出
"""
    AscII字符转换为BCD字符
"""
def asc2bcd(inAsc, pad_L0_R1 = 0):
#全部转换为大写,为后面的转换提供方便
    inAsc = inAsc.upper()
 &nb ......

Python Re

1. Basic
参考《Python正则表达式操作指南》 
模块re,perl风格的正则表达式
regex并不能解决所有的问题,有时候还是需要代码
regex基于确定性和非确定性有限自动机
2. 字符匹配(循序渐进)
元字符
. ^ $ * + ? { [ ] \ | ( )
1) "[" 和 "]"常用来指定一个字符类别,所谓字符类别就是你想匹配的一个字符集。如[ ......

实战构建Python和C++混合系统

      关于C++和Python之间互相调用的问题,可以查找到很多资料。本文将主要从解决实际问题的角度看如何构建一个Python和C++混合系统。
                       &nbs ......

Python入门的36个例子——17 Return

# 017
def lifeIsAMirror():
string = raw_input()
if string == 'I love you!':
return 'I love you, too!'
elif string == 'Fuck you!':
return ''
else:
return
# end of def
string = lifeIsAMirror()
if len(string) == 0:
print 'You have nothing.'
else: ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号