Opening a URL but with a list in Python -


i having trouble opening url list url extension. mean open .txt file (which works fine) , have put each line of text file list. want open given url list @ end, see mean in code.

this put file list:

with open( filename , 'r' ) f:     usernames = [line.strip() line in f] print( usernames ) 

and trying accomplish url:

url = 'http://twitter.com/'+usernames[0] if sys.platform == 'darwin':    #in case of os x     subprocess.popen(['open', url ]) else:     webbrowser.open_new_tab( url ) 

it's opening http://twitter.com/ , not http://twitter.com/ (word list here)

thank you


Comments