Last active
April 27, 2019 11:47
-
-
Save sshaplygin/eaaac17a50f68da3098a38eaff400b4b to your computer and use it in GitHub Desktop.
add symbol "*" to full file program
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
#!/usr/bin/python3 | |
import os | |
if name == 'main': | |
print('Start append') | |
currentDir = os.getcwd() | |
addSymbol = '*' | |
fileNames = os.listdir(currentDir) | |
docs = list(filter(lambda x: not x.endswith('.py'), fileNames)) | |
for fileName in docs: | |
file = open(fileName, 'r') | |
newName = 'new_' + fileName | |
newFile = open(newName, 'w') | |
print('new file - {0}'.format(newName)) | |
for line in file.readlines(): | |
newLine = addSymbol + '\t' + line | |
newFile.write(newLine) | |
newFile.close() | |
file.close() | |
print('End append') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment