Likely a duplicate (sorry). I looked around and couldn't find my answer.
I want to generate a list of n
empty strings in a one liner.
I've tried:
>>> list(str('') * 16)
# ['']
>>> list(str(' ') * 16)
# [' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ']
# anything with a char in it is working
The below works, but is there a better way? Why doesn't list(str('') * 16)
work?
>>> [str() for c in 'c' * 16]
['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '']