Liste des Groupes | Revenir à cl python |
...
So as I understand it, I need to convert the InstanceState-objects to,
say, dicts, in order to print them. However I also want to remove one
of the keys from the output and assumed I could just pop it off each
event dict, thus:
>
event_dicts = [vars(e) for e in events]
print(type(event_dicts[0]))
event_dicts = [e.pop('_sa_instance_state', None) for e in event_dicts]
print(type(event_dicts[0]))
>
However, this prints
>
<class 'dict'>
<class 'sqlalchemy.orm.state.InstanceState'>This is what you have popped.
>Then you do not change `event_dicts`.
If I comment out the third line, which pops the unwanted key, I get
Les messages affichés proviennent d'usenet.