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 126.96.36.199 where it should be 188.8.131.52. 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 7 Years Ago by dads: n/a