Created
March 8, 2018 10:19
-
-
Save naoyeye/a78491535e84d7c2f769e0e324e1be70 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/bin/python | |
arr = [] | |
def save(filename, contents): | |
fh = open(filename, 'w') | |
fh.write(contents) | |
fh.close() | |
def readTxt(): | |
n = 0 | |
for line in open("Coupon_browns_face_1600.txt"): | |
n = n + 1 | |
arr.append('\n {"expired": false, "coupon": "' + line.replace('\r\n', '') + '"}') | |
if (n == 800): | |
save('coupon.json', '{"results":[' + ','.join(arr) + '\n]}') | |
return | |
readTxt() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment