with open("D:/py.txt","r") as f:
print f
d=f.read()
x=d.find("-->")
d=d[x+1:]
c=""
for x in d:
if x.isalpha():
c+=x
print c
把源文件拷贝出来,保存到py.txt中。读py.txt文件,找出其中是字母的项并打印出来。仅供参考!
with open("D:/py.txt","r") as f:
print f
d=f.read()
x=d.find("-->")
d=d[x+1:]
c=""
for x in d:
if x.isalpha():
c+=x
print c
把源文件拷贝出来,保存到py.txt中。读py.txt文件,找出其中是字母的项并打印出来。仅供参考!
转载于:https://www.cnblogs.com/mxxhappy/p/3447219.html