1
2filename = "language.txt"
3#open file for writing
4fileHandler = open (filename, "w")
5
6#Add some text
7fileHandler.write("Bash\n")
8fileHandler.write("Python\n")
9fileHandler.write("PHP\n")
10
11#close the file
12fileHandler.close()
13
14#open file the file and read the data
15
16filehandler = open(filename, "r")
17
18#Read the file by line
19
20for line in fileHandler:
21 print(line)
22
23#close the file
24fileHandler.close()
25