mercredi 28 avril 2021

Generate python object using typing

How I can generate random python object using typing module? For example:

from typing import List
t: List[Set[str]]
data = generate_data(t)
print(data)  # [{"123", "asbDw"}, {"fdasa"}, *some other sets with random strings*]

It would be nice if I could specify the amount of data or its range.

P.S. I know how I can write my own implementation for different data types, but it will take a relatively long time. I would like to know if there are ready-made solutions or ideas for implementation.

Thanks in advance!




Aucun commentaire:

Enregistrer un commentaire