Skip to content

Instantly share code, notes, and snippets.

@klapauciuz
Last active September 28, 2017 22:55
Show Gist options
  • Save klapauciuz/c4e64d5f489b42d58639afafd4ab6209 to your computer and use it in GitHub Desktop.
Save klapauciuz/c4e64d5f489b42d58639afafd4ab6209 to your computer and use it in GitHub Desktop.
wonderful tricky python oneliner with open and close file and two nested loops one of which is generator
with open('output.txt', 'a') as o:contents=[o.write('http://' + random.choice(['1', '2', '3', '4', '5']) + str(random.randrange(100, 1000)) + i + '\n') for i in ['one', 'two', 'три', 'four', 'V'] for x in xrange(100)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment