# -*- coding:utf-8 -*- #
#写文件
myfile = open('hello world','w');
myfile.write('hello world');
myfile.close();
#读文件
myfile = open('hello world','r');
str = myfile.readline();
print("文件内容:\n" + str);
OutPut
文件内容:
hello world
# -*- coding:utf-8 -*- #
#写文件
myfile = open('hello world','w');
myfile.write('hello world');
myfile.close();
#读文件
myfile = open('hello world','r');
str = myfile.readline();
print("文件内容:\n" + str);
OutPut
文件内容:
hello world