Skip to Main Content
Python Rusz głową! Wydanie II
book

Python Rusz głową! Wydanie II

by Paul Barry
November 2017
Intermediate to advanced content levelIntermediate to advanced
578 pages
23h 17m
Polish
Helion
Content preview from Python Rusz głową! Wydanie II
514
Rozdział 12.
Funkcje generatorowe w działaniu
Śledzenie Twojej funkcji generatorowej (1. z 2)
Aby zrozumieć, co się dzieje podczas działania Twojej funkcji generatorowej,
prześledźmy wykonanie następującego kodu:
from url_utils import gen_from_urls
urls = (‘http://helion.pl’, ‘http://onepress.pl’, ‘http://septem.pl’)
for resp_len, status, url in gen_from_urls(urls):
print(resp_len, status, url)
Zdefiniuj
krotkę
z URL-ami.
Zaimportuj swoją
funkcję generatorową.
Użyj swojej funkcji
generatorowej jako
części pętli for.
for resp_len, status, url in gen_from_urls(urls):
Interpreter przeskakuje do funkcji
gen_from_urls
i zaczyna wykonywać jej kod.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Python. Receptury. Wydanie III

Python. Receptury. Wydanie III

David Beazley, Brian K. Jones
Python. Programuj szybko i wydajnie

Python. Programuj szybko i wydajnie

Micha Gorelick, Ian Ozsvald

Publisher Resources

ISBN: 9788328337343