I was wondering If anyone can help me changing INPUT with a txt file which has more lines, and load each line, instead only one from the INPUT. I want to change x=input('Name:')
with opening a txt file and read each line at a time.
The code:
x=input('Name:')
r=requests.get('http://mywebsite.com/a?=*.{}'.format(x))
Use fhand = open("filename.txt, 'r')
to read in the file and loop over the lines of that file using a for loop. Like this:
for line in fhand:
r=requests.get('http://mywebsite.com/a?=*.{}'.format(line))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.