Created
December 27, 2015 05:04
-
-
Save gautamk/543fb28a4fe0321e9a17 to your computer and use it in GitHub Desktop.
Convert the first line of all csv files in the current directory to lowercase
This file contains 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
import glob | |
for filename in glob.iglob("*.csv"): | |
firstline = None | |
rest = None | |
with open(filename, 'r') as f: | |
firstline = f.readline().lower() | |
rest = f.read() | |
with open(filename,'w') as f: | |
f.writelines([firstline]) | |
f.write(rest) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment