感谢所有帮助。:)
import urllib.request
ans = True
while ans:
print("""
- Menu Selection -
1. Automatic
2. Manual
3. Add
4. Exit
""")
ans = input('Select Option : ')
if ans =="1":
with urllib.request.urlopen('http://www.mywebsite.net/something.txt') as response:
html = response.read()
f = open('proxylist.txt','a')
f.write(str(html))
f.close()
print('Data saved.')
ans = True
if ans =="2":
input('Enter link : ')
link = input()
try:
with urllib.request.urlopen(link) as response:
html1 = response.read()
f = open('proxylist.txt','a+')
f.write(str(html1))
f.close()
print('Data saved.')
ans = True
except:
print('User Input Error')
ans = True
您尝试输入数据两次,但忽略了第一个结果:
将其更改为:
相关问题 更多 >
编程相关推荐