📅  最后修改于: 2022-03-11 14:46:04.973000             🧑  作者: Mango
#there are many modes you can open files in. r means read.
file = open('C:\Users\yourname\files\file.txt','r')
text = file.read()
#you can write a string to it, too!
file = open('C:\Users\yourname\files\file.txt','w')
file.write('This is a typical string')
#don't forget to close it afterwards!
file.close()