read(size=-1)

Diez B. Roggisch deets at nospam.web.de
Tue Aug 7 08:41:51 CEST 2007


7stud schrieb:
> Suppose I write:
> 
> f = open("myimg.jpg")
> f.read(10)
> 
> 
> According to the docs,
> -----------
> read([size])
> 
> Read at most size bytes from the file....The bytes are returned as a
> string object.
> ----------
> 
> How does python convert a byte to a string?

A string _is_ a  sequence of bytes - there is nothing to convert.

Diez




More information about the Python-list mailing list