Python Open File

By Cyber Mentor

In Python, the open function can be used to open a files for writing, for reading and for append. Python open a file for reading: file = open(‘my_file.txt’,’r’) The r is implied, so it’s not needed. file = open(‘my_file.txt’) open file for writing: file = open(‘my_file.txt’,’w’) open for append: file = open(‘my_file.txt’,’a’) Python write to…