cat = "["
for row in res:
cat = cat + (str((row['weeks'])) + ',')
cat = (cat + "]").replace(',]', ']')
The above bit of code gives a result string as:
[30,31,32,33,34,35,36,37,38,39,40]
However what I want is:
[W30,W31,W32,W33,W34,W35,W36,W37,W38,W39,W40]
I have been unsuccessful in concatenating the W before each number. How could I do this?
This is the unsuccessful code that I tried:
cat = cat + (str('W'+ (row['weeks'])) + ',')
'W{},'.format(row[weeks])?W[30, 31, ..., 40],.row['weeks']. This will probably stop other guesses.