-
-
Save racterub/2ead6cc2fc1f8f3099ef8d79b4a2930a to your computer and use it in GitHub Desktop.
抽順序
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/lib/env python | |
import random | |
f = open('data', 'r') | |
a = {} | |
for line in f: | |
k, v = line.strip().split('=') | |
a[k.strip()] = v.strip() | |
f.close() | |
r = open('result', 'w') | |
for i in random.sample(a.items(), 6): | |
ni = list(i) | |
if len(ni[1].split(',')) >= 5: | |
r.write(str(ni) + " " + str("Length:5 min") + "\n") | |
else: | |
r.write(str(ni) + " " + str("Length:4 min") + "\n") | |
r.close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment