Last active
March 29, 2017 19:54
-
-
Save jjsahalf/3cda19d657470ce3b2eaeba1e55ce089 to your computer and use it in GitHub Desktop.
Basic file open, read, write, replace operations.
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
import os, sys | |
os.system("find "+sys.argv[1]+" -type f > "+sys.argv[1]+"/namelist") | |
writeFile=open(sys.argv[1]+"/output", "w") | |
with open(sys.argv[1]+"/namelist") as f: | |
for line in f: | |
arr=line.split(".") | |
newLine=arr[1][1:] | |
newLine=newLine.replace("/", ".") | |
if newLine == "namelist": | |
continue | |
if newLine == "getClassList": | |
continue | |
writeFile.write(newLine+"\n") | |
print newLine | |
writeFile.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment