Answers for "x read in file handling python"

11

python file open

#there are many modes you can open files in. r means read.
file = open('C:Usersyournamefilesfile.txt','r')
text = file.read()

#you can write a string to it, too!
file = open('C:Usersyournamefilesfile.txt','w')
file.write('This is a typical string')

#don't forget to close it afterwards!
file.close()
Posted by: Guest on March-26-2020

Code answers related to "x read in file handling python"

Python Answers by Framework

Browse Popular Code Answers by Language