[Python-de] open file

Andreas Jung lists at zopyx.com
Mo Sep 21 10:08:27 CEST 2009


http://docs.python.org/library/stdtypes.html

-> File Objects.

Andreas

On 21.09.09 08:40, Matthias Huening wrote:
> Hallo,
>
> gibt es eigentlich einen prinzipiellen Unterschied zwischen:
>
> (a)
> for zeile in open(datei):
>     tu_was()
>
> und:
>
> (b)
> with open(datei) as f:
>     for zeile in f:
>         tu_was()
>
>
> Ist eine der beiden Möglichkeiten schneller, besser, schöner?
> Wenn ja, warum?
>
> Schöne Grüße, Matthias
>
>
> _______________________________________________
> python-de maillist  -  python-de at python.net
> http://python.net/mailman/listinfo/python-de


-- 
ZOPYX Ltd. & Co KG          \  ZOPYX & Friends
Charlottenstr. 37/1          \  The experts for your Python, Zope and
D-72070 Tübingen              \  Plone projects
www.zopyx.com, info at zopyx.com  \  www.zopyx.de/friends, friends at zopyx.de
------------------------------------------------------------------------
E-Publishing, Python, Zope & Plone development, Consulting


-------------- nächster Teil --------------
Ein Dateianhang mit Binärdaten wurde abgetrennt...
Dateiname   : lists.vcf
Dateityp    : text/x-vcard
Dateigröße  : 316 bytes
Beschreibung: nicht verfügbar
URL         : <http://mail.python.org/pipermail/python-de/attachments/20090921/db8e3be6/attachment-0001.vcf>


Mehr Informationen über die Mailingliste python-de