Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # main.py
- def main():
- separator = {'(': 'separator', ')': 'separator',
- ';': 'separator', '%%': 'separator'}
- val = input("Enter filename: ")
- fileName = val
- sourceCodeFile = open(fileName, encoding='utf-8')
- for line in sourceCodeFile:
- line_stripped = line.strip()
- outputFile = open("output_test1.txt", "a")
- if line_stripped in separator:
- outputFile.write(
- f"{ separator[line_stripped] } : {line_stripped} \n")
- sourceCodeFile.close()
- outputFile.close()
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement