Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > cz.comp.lang.python > #3220
| Path | csiph.com!feeder.erje.net!2.eu.feeder.erje.net!feed.usenet.farm!feeder4.usenet.farm!border1.nntp.ams1.giganews.com!nntp.giganews.com!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.fr7!futter-mich.highwinds-media.com!news.highwinds-media.com!fx27.am4.POSTED!not-for-mail |
|---|---|
| Received-SPF | unknown (Address does not pass the Sender Policy Framework) SPF=MAILFROM; sender=macek@sandbox.cz; remoteip=::ffff:87.236.197.188; remotehost=; helo=mx.sandbox.cz; receiver=hugo.zagamma.cz; |
| From | Vláďa Macek <macek@sandbox.cz> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 |
| MIME-Version | 1.0 |
| In-Reply-To | <013c3421-291d-48d1-ade6-5fff922dc88e@googlegroups.com> |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 8bit |
| Content-Language | cs |
| Received-SPF | unknown (Address does not pass the Sender Policy Framework) SPF=FROM; sender=macek@sandbox.cz; remoteip=::ffff:87.236.197.188; remotehost=; helo=mx.sandbox.cz; receiver=hugo.zagamma.cz; |
| Subject | Re: [python] Buducnost Pythonu: lambda, map, filter |
| X-BeenThere | python@py.cz |
| X-Mailman-Version | 2.1.24 |
| Precedence | list |
| List-Id | Konference PyCZ <python.py.cz> |
| List-Unsubscribe | <http://www.py.cz/mailman/options/python>, <mailto:python-request@py.cz?subject=unsubscribe> |
| List-Archive | <http://www.py.cz/pipermail/python/> |
| List-Post | <mailto:python@py.cz> |
| List-Help | <mailto:python-request@py.cz?subject=help> |
| List-Subscribe | <http://www.py.cz/mailman/listinfo/python>, <mailto:python-request@py.cz?subject=subscribe> |
| Newsgroups | cz.comp.lang.python |
| Message-ID | <mailman.52.1513157297.2736.python@py.cz> (permalink) |
| X-Mailman-Original-Message-ID | <1a690406-a8a3-7fae-bbcf-fecad32273b0@sandbox.cz> |
| X-Mailman-Original-References | <mailman.155.1163440992.6465.python@py.cz> <ejav0f$7re$1@news.vol.cz> <CANeQL52LSnza=Wg7pyEB0kzkOLfRUqY49z+5Fi+VWeQ0SLtWrw@mail.gmail.com> <mailman.41.1513083112.2736.python@py.cz> <013c3421-291d-48d1-ade6-5fff922dc88e@googlegroups.com> |
| References | <mailman.155.1163440992.6465.python@py.cz> <ejav0f$7re$1@news.vol.cz> <CANeQL52LSnza=Wg7pyEB0kzkOLfRUqY49z+5Fi+VWeQ0SLtWrw@mail.gmail.com> <mailman.41.1513083112.2736.python@py.cz> <013c3421-291d-48d1-ade6-5fff922dc88e@googlegroups.com> <1a690406-a8a3-7fae-bbcf-fecad32273b0@sandbox.cz> |
| Lines | 78 |
| X-Complaints-To | abuse@usenet-news.net |
| NNTP-Posting-Date | Wed, 13 Dec 2017 09:28:17 UTC |
| Organization | usenet-news.net |
| Date | Wed, 13 Dec 2017 10:28:08 +0100 |
| X-Received-Bytes | 3683 |
| X-Received-Body-CRC | 3613748798 |
| X-Original-Bytes | 3632 |
| Xref | csiph.com cz.comp.lang.python:3220 |
Show key headers only | View raw
Ano! A je to pěkná ukázka stability jazyka, není-liž pravda?
Nabízím ještě tvořivě generátor sad buněk dělených tabulátorem. :-)
line_cells = (line.split('\t') for line in open('data.txt'))
Po konzumaci generátoru se soubor sám zavře (Python 2.7.12 i 3.5.2).
To samé platí i pro `for line in open(...):`.
Hezké Vánoce,
V.
On 13.12.2017 10:02, Pavel Schön wrote:
> Děkujeme za oživení 11 let starého vlákna, na tyto věci se prostě nesmí zapomenout... :-)
>
> Dne úterý 12. prosince 2017 13:51:54 UTC+1 Petr Mach napsal(a):
>> Dnes je ještě lepší toto:
>> with open('data.txt') as f:
>> for line in f:
>> print line
>>
>>
>>
>> Dne 31. 3. 2017 13:35 napsal uživatel "Petr Přikryl" <pri...@atlas.cz>:
>> Roman Miklos napsal(a):
>>
>>
>> Radsej by som naopak uvital keby sa preberalo stale viac, napriklad keby
>>
>> bolo mozne namiesto
>>
>>
>>
>> f = open("data.txt")
>>
>> line = f.readline() while line:
>>
>> print line
>>
>> line = f.readline()
>>
>> f.close()
>>
>>
>>
>> napisat jednoducho ako v Perle a C++
>>
>>
>>
>> f = open("data.txt")
>>
>> while line = f.readline():
>>
>> print line f.close()
>>
>>
>>
>>
>> Já raději píšu
>>
>>
>>
>> f = open("data.txt")
>>
>> for line in f:
>>
>> print line
>>
>> f.close()
>>
>>
>>
>>
>>
>> pepr
Back to cz.comp.lang.python | Previous | Next — Previous in thread | Find similar
Re: [python] Buducnost Pythonu: lambda, map, filter Pavel Schön <pavel@schon.cz> - 2017-12-13 01:02 -0800 Re: [python] Buducnost Pythonu: lambda, map, filter Vláďa Macek <macek@sandbox.cz> - 2017-12-13 10:28 +0100
csiph-web