/ Published in: Python
I am tired of having to go through text and adding quotation marks and commas to strings or just commas after numbers... f-that. Fixed.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
f = open("filename.txt", "r+") for line in f: newline = line.rstrip('\n') if(newline.isalpha()): print '"'+ newline + '", ' elif(newline.isalnum()): print newline + ", " else: print '"'+ newline + '", ' f.close()