Flask - Populate Selectfield Choices With Array
Newbie here, been writing Python scripts for little bit more than 6 months. I'm trying to populate a wtf SelectField with a list, returned from a function that fetches the data f
You unnecessarily create string in for
loop in get_channels_list
function.
Change it to this:
for i in a['channels']:
list1.append((i['name'], '#' + i['name']))
or to be even more pythonic:
return [(i['name'], '#' + i['name']) for i in a['channels']]
Post a Comment for "Flask - Populate Selectfield Choices With Array"