I have to make some bookmarks so I quickly knocked up the script below and ran it. It created the files fine but with a with an incorrect ip in the second file
The second bookmark created should be named York.URL which it is but the ip address of the url is 22.214.171.124 where it should be 126.96.36.199. It uses the enumerate value and adds 1 each time.
I'd imagine I'd be able to get the desired outcome by using other methods but what is going on here? Am I missing something obvious?
from __future__ import print_function shops = [ 'Windermere', 'York', 'Chester' ] for i, s in enumerate(shops): f = open('%s.URL' % (s), 'w') f.write('[InternetShortcut]\nURL=http://192.65.%s.95/BackO' % (i+1)) f.close() print('%s completed' % s)
Edited by dads: n/a