发布时间:2019-08-11 11:26:28编辑:auto阅读(1314)
文件 1 内容如下
#some words
Sometimes in life,
You find a special friend;
Someone who changes your life just by being part of it.
Someone who makes you laugh until you can't stop;
Someone who makes you believe that there really is good in the world.
Someone who convinces you that there really is an unlocked door just waiting
for you to open it.
This is Forever Friendship.
使用读文件过滤空行和注释行
import re
file=open("1",'r')
a=file.readlines()
a.sort()
for line in a:
if re.match("^#",line):
pass
elif re.match("^$",line):
pass
else:
print line.strip()
上一篇: Python 数值计算
下一篇: Python-工具安装
46587
44489
35920
33485
28171
24741
23661
18867
18161
16846
4656°
5215°
4744°
4878°
5543°
4506°
4559°
5099°
5003°
6252°