I have multiple variables that were created, stringa - stringc. I am trying to find a way to iterative create these variable names and use them as input for a function, without having to type them in individually.
import string
stringa = ['item1', 'item2', item3']
stringb = ['sitem1', 'sitem2']
stringc = ['sitemc', 'sitemc']
def edittext(t):
t = t.upper()
return t
finallist = []
for i in range(3):
letter = string.ascii_lowercase[i]
finalist.append('string' + letter)
finallist.append(edittext(('string' + letter).strip('\'')))
This is my output for the finallist.
Out [212]: ['stringa', 'STRINGA', 'stringb', 'STRINGB', 'stringc', 'STRINGC']
This is what I'm trying to accomplish:
['stringa', 'item1', 'item2', item3', 'stringb', 'sitem1', 'sitem2', 'stringc', 'sitemc', 'sitemc']