37,719
社区成员
发帖
与我相关
我的任务
分享
183.207.224.17:83
211.138.121.38:83
210.14.138.102:8080
222.74.6.32:8000
210.14.152.91:80
111.1.36.166:80
111.1.36.166:82
218.4.236.117:80
210.14.152.91:8080
120.197.53.198:8080
111.161.126.85:80
221.180.147.30:81
111.161.126.87:8080
with open( sys.argv[2] ) as x:
proxy_proxy = [ eval('(\'' + i.strip().replace(':','\', ') + ')') for i in x.readlines() ]
代码可读性比巧妙的代码重要
[(j[0], int(j[1].strip())) for j in [i.split(":") for i in x]]
with open(r"C:\Users\lenovo\Desktop\1111.txt", 'r') as f:
print [(j[0], int(j[1])) for j in [i.replace('\n', '').split(':') for i in f]]
>>> ================================ RESTART ================================
>>>
[('183.207.224.17', 83), ('211.138.121.38', 83), ('210.14.138.102', 8080), ('222.74.6.32', 8000), ('210.14.152.91', 80), ('111.1.36.166', 80), ('111.1.36.166', 82), ('218.4.236.117', 80), ('210.14.152.91', 8080), ('120.197.53.198', 8080), ('111.161.126.85', 80), ('221.180.147.30', 81), ('111.161.126.87', 8080)]
>>>