|
发表于 2019-10-25 20:14:02
|
显示全部楼层
课后题:
测试题:
0.B 应该和转义字符有关;
>>> f = open('E:\\Python\\小甲鱼\\2/test0.txt')
Traceback (most recent call last):
File "<pyshell#22>", line 1, in <module>
f = open('E:\\Python\\小甲鱼\\2/test0.txt')
FileNotFoundError: [Errno 2] No such file or directory: 'E:\\Python\\小甲鱼\\2/test0.txt'
>>> f = open('E:\\Python\\小甲鱼\\2/test0.txt','w')
>>> f = open('E:\\Python\\小甲鱼\\2\test1.txt','w')
Traceback (most recent call last):
File "<pyshell#24>", line 1, in <module>
f = open('E:\\Python\\小甲鱼\\2\test1.txt','w')
OSError: [Errno 22] Invalid argument: 'E:\\Python\\小甲鱼\\2\test1.txt'
>>> f = open('E:\\Python\\小甲鱼\\2//test2.txt','w')
1.可读
2.二进制,可执行
3.这个不太清楚
4.
5.
>>> for each in f:
print(each)
尔康:肿么了,我们昨天不是已经把话说明白了吗?又出什么事了?脸色怎么这么苍白?为什么不看着哥?
紫薇:你骗我?
尔康:我又怎么了?
紫薇:紫薇。你跟我说你和紫薇没有过去,可是在回廊下看雪看月亮谈了整整一晚,难道这不算是过去吗?你可以爱柳青柳红,可以爱小燕子,可以爱紫薇,可以爱五阿哥,就不可以爱我吗?
6.
>>> f.read(10)
'尔康:肿么了,我们昨'
7。tell()
8.我测试完没出错啊。
>>> f.seek(45,0)
45
|
|