Created
October 25, 2022 04:26
-
-
Save iisaka51/533b928bb9bd996666273493c9036155 to your computer and use it in GitHub Desktop.
users_class not define __repr__
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [4]: class User: | |
...: | |
...: def __init__(self, *nargs, **kwargs): | |
...: self.data = dict(*nargs, **kwargs) | |
...: self.id: int = self.data['id'] | |
...: self.name: str = self.data['name'] | |
...: self.age: int = self.data['age'] | |
...: self.belongs: str = self.data['belongs'] | |
...: | |
In [5]: io.read_contents('sqlite:///users.sqlite#users',row_type=User) | |
Out[5]: | |
[<__main__.User at 0x1092c0f40>, | |
<__main__.User at 0x1092c3430>, | |
<__main__.User at 0x1092c0cd0>, | |
<__main__.User at 0x1092c1d20>, | |
<__main__.User at 0x1092c26e0>, | |
<__main__.User at 0x1092c1660>] | |
In [6]: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment