|
发表于 2022-12-24 15:18:03
|
显示全部楼层
本帖最后由 Ensoleile 于 2022-12-24 15:39 编辑
问答题答案:
0.不会报错,会创建一个文件
1.flush()
2.读取三个字符
3.一行
4.print()默认结尾加一个换行
5.文件中存在转义符
6.会覆盖已存在的文件
7.可以
8.指向文件的编辑位置
9.end of file,结束符
10.f.tell()
动动手答案:
0.
with open('D:/EdgeDownload/FishC.txt', 'r') as f:
f.seek(9)
store = f.read(6)
with open('E:/FishD.txt','a') as f:
f.write(store)
1.
with open('D:/EdgeDownload/FishC.txt', 'r') as f:
f.seek(0)
store = f.read(15)
with open('D:/EdgeDownload/FishC.txt', 'w') as f:
f.write(store)
2.
with open('./open_myself.py','r') as f:
for each in f:
print(each,end='')
3.
with open(r'D:/EdgeDownload/hw/target.zip','rb') as f1:
with open(r'D:/EdgeDownload/hw/test.jpg','ab') as f2:
f1.seek(0)
f2.write(f1.read())
|
|