I am a very beginner in python and I want to repeat this code. But I dont't really know how to do this without "goto". I tried to learn about loops for hours but still no sucess. Any ideas ?
import requests
addr = input()
vendor = requests.get('http://api.macvendors.com/' + addr).text
print(addr, vendor)
解决方案
Create a function repeat and add your code in it. Then use while True for infinite call or for i in range(6) for 6 times call`:
import requests
def repeat():
addr = input()
vendor = requests.get('http://api.macvendors.com/' + addr).text
print(addr, vendor)
while True:
repeat()
Note that goto is not recommended in any language and is not available in python. It causes a lot of problems.