I am trying to convert the contents a set of files to only uppercase characters. Heres the code I have so far:
import os
def test():
os.chdir(\"C:/Users/Dav
import os
def test(x):
with open(x, "r+b") as file:
content = file.read()
file.seek(0)
file.write(content.upper())
The above should work if you pass the file name in x
Below is command line version to do the same for a single file & you can invoke from the terminal by ls -1 | parallel python upper.py
import os, sys
with open(sys.argv[1], "r+b") as file:
content = file.read()
file.seek(0)
file.write(content.upper())