Skip to content

Instantly share code, notes, and snippets.

@racterub
Last active February 21, 2017 15:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save racterub/1795a3269352961a6b49dd5e81e7b0f7 to your computer and use it in GitHub Desktop.
Save racterub/1795a3269352961a6b49dd5e81e7b0f7 to your computer and use it in GitHub Desktop.
123132
#!/usr/lib/env python
f = open('data', 'w+')
s = {}
for line in f:
k, v = line.strip().split('=')
s[k.strip()] = v.strip()
for i in random.sample(a.items(), 3):
f.write(str(i) + "\n")
f.close()
#!/usr/lib/env python
#open data
f = open('data', 'r')
s = {}
#turn data in to dict
for line in f:
k, v = line.strip().split('=')
s[k.strip()] = v.strip()
f.close()
#create and write result
f = open('result.txt', 'w')
f = open('data', 'w+')
for i in random.sample(s.items(), 3):
f.write(str(i) + "\n")
f.close()
1 = "eadad"
2 = "dgsgsg"
3 = "fhaha"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment