clout = requests.get('https://pastebin.com/raw/j4Amhah6')
with open("MODULEADVANCED.txt", "w") as file:
file.write(clout.text.rstrip())
with open('MODULEADVANCED.txt', "r") as file:
for eachLine in file:
try:
proxies = {
'http': eachLine.rstrip(),
'https': eachLine.rstrip()
}
print(proxies['http'].rstrip())
except:
print("an error has occured")
此代码输出以下内容:
127.0.0.1:0000
127.0.0.1:0000
127.0.0.1:0000
127.0.0.1:0000
127.0.0.1:0000
127.0.0.1:0000
那些空白空间只是向系统添加不合理的负载.. 我试着把.rstrip()撒到任何地方,但没有骰子......
答案 0 :(得分:0)
解决问题的一种方法(虽然不是正确的方法)是:
print(proxies['http'].rstrip(), end='')
如果然后将所有内容打印在一行上,那么您可以将不必要的\n
保存到文件中,因此您应该检查第一部分
with open("MODULEADVANCED.txt", "w") as file:
file.write(clout.text.strip())
可能?