wyh2006 发表于 2017-5-20 16:32:24

多谢楼主分享!!!!!

zxp1310 发表于 2017-8-5 15:25:22

小甲鱼是不是叫李佳宇(甲鱼){:5_91:}
在在视频中看到了   

lightmagic 发表于 2017-8-10 14:39:07

f = input('请输入文件名:')

file_name = open('e:/' + f + '.txt','w')

while 1 :

    w = input('请输入内容,(单独输入‘:w’保存退出):')
    file_name.write(w + '\n')
    if w == ':w':
      file_name.close()
      print('文件已保存')
      break

南山兰 发表于 2017-8-15 15:05:32

还是需要多练

nkd50 发表于 2017-8-16 12:51:45

好教程便于查询

lightmagic 发表于 2017-8-16 17:10:49

看答案

小泉向西流 发表于 2017-8-20 17:00:45

学习打卡。

家丁 发表于 2017-8-22 00:03:01

已收藏感谢

悟空dada 发表于 2017-8-22 19:51:08

请问,如果要在一个特定路径下新建一个文件,只能这样:
>>>os.chdir(path)
>>>open('test.txt','w')
有没有其他的函数,一步实现的

张无忌哈哈哈 发表于 2017-8-25 22:40:05

希望有人可以解答   
我在做028讲   文件的内容课后习题的时候

动动手第0题

f = open('OpenMe.mp3')
for each_line in f:
      print(each_line, end='')
f.close()


报错如下

Traceback (most recent call last):
File "haha.py", line 2, in <module>
    for each_line in f:
File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/codecs.py", line 321, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb3 in position 0: invalid start byte


我用的是mac air
会不会是我默认参数设置有问题
其他代码也是报错
同样的报错


望协助

lainy 发表于 2017-9-2 10:25:24

很不错的内容

IGSSIS 发表于 2017-9-17 14:41:38

小甲鱼我在3.3里面又发现一个现象使用 readline 和readlines是完全不同的哈哈

黯然销魂饭 发表于 2017-9-19 09:21:08

找不到{:10_249:}

justinan 发表于 2017-10-4 14:58:20

请问文件的读取,文件放在桌面为什么会无法开启呢

会显示FileNotFoundError: No such file or directory: '123.txt'

谢谢

YINXINGSHU 发表于 2017-10-23 09:18:22

感谢小甲鱼

xiaohaoge233 发表于 2017-10-24 17:21:34

感谢

chenzuzhan 发表于 2017-11-13 23:08:04

{:5_98:}{:5_99:}{:5_100:}

胃里有只猪 发表于 2017-12-6 20:22:00

哇,解答困惑

胃里有只猪 发表于 2017-12-6 20:22:42

哇,解答困惑

hellomicro 发表于 2017-12-12 15:44:10

{:10_249:}{:10_249:}{:10_249:}{:10_249:}支持小甲鱼
页: 1 2 3 4 5 [6] 7 8 9 10 11 12 13 14 15
查看完整版本: 文件的打开模式和文件对象方法