python - Expanding tuples in list comprehension generator -


i using function

def convert_tuple(self, listobj, fields=['start', 'end', 'user']):     return [(getattr(obj, field)  field in fields)             obj in listobj]  

my desired output want should be

[('2am', '5am', 'john'), ('3am', '5am', 'john1'), ('3am', '5am', 'john2') ] 

the output of above function is

[genexp, genexp, genexp]  

its generator expression , not able expand wanted

typecast gen-exp tuple

def convert_tuple(self, listobj, fields=['start', 'end', 'user']):     return [tuple(getattr(obj, field)  field in fields)             obj in listobj]  

Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -