Closed matthdsm closed 4 years ago
you can probably get it via:
d = {k: gr[k] for k in gr.keys}
Hi Brent,
Thanks for the suggestion, but no dice:
File "/Users/matdsmet/OneDrive - UGent/Projects/seqplorer_django/seqplorer/seqplorer_ui/views.py", line 149, in query
print({k: row[k] for k in row.keys})
TypeError: 'method' object is not iterable
Any other suggestion? Thanks M
Try: print({k: row[k] for k in row.keys()})
Agh, stupid mistake, didn't call the keys method. Silly me. Thanks for the tip!
I've had to make a small modification to the code though, the keys
method is now:
def keys(self):
return self.row.keys() + self.cache.keys()
which doesn't work in python3, since self.row.keys()
is a list
and self.cache.keys()
is a dict_keys
type list. Casting self.cache.keys()
as a list like so list(self.cache.keys())
fixes this issue, which in turn fixes my issue!
Thanks for all the help. I'll open a PR with the fix. Cheers M
Hi Brent,
is it possible to get a
dict
type return from anGeminiRow
object using the existing code? Alternatively, would it be possible to add a__dict__
method to the class?Thanks Matthias