I want to create a lot of variables, all containing the same value.
Currently, I do this:
foo, bar, qaxx, spat = ("1Value4All",)*4
my_variables = [foo, bar, qaxx, spat, dung, polo]
for v in my_variables:
v = "1Value4All"
You can chain all the variables together in one line.
foo = bar = qaxx = spat = "1Value4All"
Edit: Below you state your data is either string or NoneType. This would work for both.
>>> foo = bar = None >>> type(foo); type(bar) <type 'NoneType'> <type 'NoneType'> >>> foo = bar = "1Value4All" >>> type(foo); type(bar) <type 'str'> <type 'str'>