Is there a way to get the following result in Python?

Jach Feng jfong at ms4.hinet.net
Fri Jun 11 22:02:25 EDT 2021


>>> def foo():
...     # do something
...
>>> a = []
>>> for i in range(3):
...     a.append(foo())
...
>>> a
[]
>>>

--Jach


More information about the Python-list mailing list