Mahdi Zojajiدوستان چرا هیچی پرینت نمیشه؟
A coroutine/generator is created in a paused state
Call .send(...)/next() to make it resume
Mahdi Zojajiمیگم چرا اون تابع پرینت کار نمیکنه
چون این یه ژنراتور هست. خاصیتش اینطور. شما اون get_urls رو تو پرینت قرار بدین درست میشه
M
پیوند
برای نمایش کلیک کنید
برای نمایش کلیک کنید
Under pep 255:
When a generator function is called, the actual arguments are bound to function-local formal argument names in the usual way, but no code in the body of the function is executed. Instead a generator-iterator object is returned; this conforms to the iterator protocol, so in particular can be used in for-loops in a natural way. Note that when the intent is clear from context, the unqualified name "generator" may be used to refer either to a generator-function or a generator-iterator.
M M M