circuitpython/tests/basics/bytes_gen.py

6 lines
114 B
Python

# construct a bytes object from a generator
def gen():
for i in range(4):
yield i
print(bytes(gen()))