Skip to content

Instantly share code, notes, and snippets.

@sshaplygin
Last active April 27, 2019 11:47
Show Gist options
  • Save sshaplygin/eaaac17a50f68da3098a38eaff400b4b to your computer and use it in GitHub Desktop.
Save sshaplygin/eaaac17a50f68da3098a38eaff400b4b to your computer and use it in GitHub Desktop.
add symbol "*" to full file program
#!/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