python - Create a tuple using loop with possibly None element -


please see code below.

i need create tuple, many elements empty(none). so, creating list , converting tuple. know tuple immutable, , hence, there standard way of creating tuple? (i worried). how can better?

datadict = [] datadict.append(1) datadict.append(name) datadict.append(self.keyentry.get_text()) field in self.fields:     if self.all_fields[field].get_text():         datadict.append(self.all_fields[field].get_text())     else:         datadict.append(none) datatup = tuple(datadict) 

what this?

data = tuple(self.all_fields[field].get_text() or none field in self.fields) 

Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -