[Tutor] File transfer

Chris King g.nius.ck at gmail.com
Sun Oct 31 17:06:18 CET 2010


  On 10/31/2010 12:03 PM, Corey Richardson wrote:
>
>
> On 10/31/2010 11:51 AM, Chris King wrote:
>> On 10/30/2010 10:08 PM, Corey Richardson wrote:
>>> If you can send a list, have the list [name, data] where name is the 
>>> file name and data is the raw binary of the file, contained in a string.
>>>
>>> On 10/30/2010 9:11 PM, Chris King wrote:
>>>>  Dear Tutors,
>>>>     How would I send a file from one computer to another. I have 
>>>> modules which can send simple objects, such as dictionaries with 
>>>> simple objects in it. They can't send files thou. Please help.
>>>>
>>>> Sincerely,
>>>>     Me
>>>>
>>>>
>>>> _______________________________________________
>>>> Tutor maillist  -Tutor at python.org
>>>> To unsubscribe or change subscription options:
>>>> http://mail.python.org/mailman/listinfo/tutor
>> how do I get raw binary from a file, or preferably a folder?
> In order to send a folder, you would have to zip it up using the 
> zipfile module.http://docs.python.org/library/zipfile.html
>
> To read from a file, you open it, and then read() it into a string 
> like this:
> for line in file:
>     string += string + file.readline()
>
> That is the basic concept, but it should carry you far.
I don't think readline will work an image. How do you get raw binary 
from a zip? Also make sure you do reply to the tutor list too, not just me.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20101031/fe3334ab/attachment.html>


More information about the Tutor mailing list