x=['a','b','c']
y=['d','e','f']
z=['g','h','i']
string='x' 
#Now I would like to somehow get the list printed or returned by only using the string variable.
x=['a','b','c']
y=['d','e','f']
z=['g','h','i']
string='x' 
#Now I would like to somehow get the list printed or returned by only using the string variable.
 
    
    Use globals or locals:
x=['a','b','c']
y=['d','e','f']
z=['g','h','i']
string='x'
print(globals()[string])
['a','b','c']
 
    
    If you have multiple list and you want to print them based on some key it's best to use a dictionary.
lstDic = {
    "x":['a','b','c'],
    "y":['d','e','f'],
    "y":['g','h','i']
}
string='x'
print(lstDic[string])
