Python论坛  - 讨论区

标题:[python-chinese] 文件读取问题

2006年06月21日 星期三 21:54

hailang_0512 at 163.com hailang_0512 at 163.com
Wed Jun 21 21:54:40 HKT 2006

ff=open("c:\\aa.jpg","rb")

test=open("c:\\bb.jpg","w")

data=ff.read()
test.write(data)

文件怎么复制不成功?bb.jpg的大小才0KB?
看api,read()是读入所有的数据,当没有参数时.


[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年06月21日 星期三 22:47

swordsp sparas2006 at gmail.com
Wed Jun 21 22:47:55 HKT 2006

test.close()

On 6/21/06, hailang_0512 at 163.com <hailang_0512 at 163.com> wrote:
>
>
> ff=open("c:\\aa.jpg","rb")
>
> test=open("c:\\bb.jpg","w")
>
> data=ff.read()
> test.write(data)
>
> 文件怎么复制不成功?bb.jpg的大小才0KB?
> 看api,read()是读入所有的数据,当没有参数时.
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060621/098a03c2/attachment.html

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年06月21日 星期三 23:58

hailang_0512 at 163.com hailang_0512 at 163.com
Wed Jun 21 23:58:17 HKT 2006

swordsp 写道:
> test.close()
>
> On 6/21/06, *hailang_0512 at 163.com hailang_0512 at 163.com>*
> <hailang_0512 at 163.com hailang_0512 at 163.com> > wrote:
>
>
>     ff=open("c:\\aa.jpg","rb")
>
>     test=open("c:\\bb.jpg","w")
>
>     data=ff.read()
>     test.write(data)
>
>     文件怎么复制不成功?bb.jpg的大小才0KB?
>     看api,read()是读入所有的数据,当没有参数时.
>
>     _______________________________________________
>     python-chinese
>     Post: send python-chinese at lists.python.cn
>     python-chinese at lists.python.cn>
>     Subscribe: send subscribe to
>     python-chinese-request at lists.python.cn
>     python-chinese-request at lists.python.cn>
>     Unsubscribe: send unsubscribe to
>     python-chinese-request at lists.python.cn
>     python-chinese-request at lists.python.cn>
>     Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
加上close()也不管用啊.


[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年06月22日 星期四 00:20

Jason Liu telecomliu at gmail.com
Thu Jun 22 00:20:13 HKT 2006

在06-6-21,hailang_0512 at 163.com <hailang_0512 at 163.com> 写道:
>
>
> ff=open("c:\\aa.jpg","rb")
>
> test=open("c:\\bb.jpg","w")
>
> data=ff.read()
> test.write(data)
>
> 文件怎么复制不成功?bb.jpg的大小才0KB?
> 看api,read()是读入所有的数据,当没有参数时.
>
> 先检查一下data的大小
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060622/e5ec095f/attachment.htm

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年06月22日 星期四 04:24

大熊 bearsprite at gmail.com
Thu Jun 22 04:24:14 HKT 2006

你读的时候使用b标志,写的时候怎么忘记该标志了?
test=open("c:\\bb.jpg","wb")

在06-6-21,hailang_0512 at 163.com <hailang_0512 at 163.com> 写道:
>
>
> ff=open("c:\\aa.jpg","rb")
>
> test=open("c:\\bb.jpg","w")
>
> data=ff.read()
> test.write(data)
>
> 文件怎么复制不成功?bb.jpg的大小才0KB?
> 看api,read()是读入所有的数据,当没有参数时.
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>



-- 
茫茫人海,你是我的最爱
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060622/3dd08c1d/attachment.html

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2006年06月24日 星期六 21:15

麦田守望者 qcxhome at gmail.com
Sat Jun 24 21:15:40 HKT 2006

没啥问题。使用wb打开目标文件

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号