消除杂散空间和组合线

时间:2019-05-03 04:29:53

标签: python-3.x

在TEXT文件中,我需要删除流线和空格 后记,将xxx.xxx.xxx.xxx文本与“:”组合以分隔xxxx / xxxxx

Example:
  

192.xxx.xx.xx:2523

#Clean Socks4
o = open("ScrapedProxys.txt","w")
data = open("temp").read()
o.write(re.sub("Socks4","",data))
o.close()
#Remove temp
os.remove("temp")
#Remove all char
string = open('ScrapedProxys.txt').read()
new_str = re.sub('[a-zA-Z]', ' ', string)
open('ScrapedProxys.txt', 'w').write(new_str)
#Remove Blank lines
''.join(l for l in open('ScrapedProxys.txt') if l.rstrip())

带有代码的当前输出图像

Output.txt

0 个答案:

没有答案