Revision: 69085
Updated Code
at April 18, 2015 12:07 by joshuaherman
Updated Code
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()
Revision: 69084
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at April 18, 2015 12:05 by joshuaherman
Initial Code
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()
Initial URL
Initial Description
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.
Initial Title
Format that Crap to an Array
Initial Tags
number, array
Initial Language
Python