I am looking for a way to convert a string into an existing variable name of a list, I am a beginner in this field and trying to develop a simple program and I encounter this kind of a problem I have, to summarize, I need to pass a parameter to function which is a string, and to that said function I need that parameter to be converted as a variable name so I can access the lists that has the same name as that string.
this is my code:
#datachart.py
datos = [0,100,100] #I need to access this and print it to another script
#main.py
from datachart import *
def data_send(usr):
#Now the user input which is a string is now here as 'usr'
#The problem is here, I cant access the lists from datachart cause
#using usr[0] will just take the character of a string.
#somecode or something to turn usr into a recognizable variable name
#of a list from datachart which is named as datos to be able to do
#the code below:
print("Coins: {} Tokens: {} Money: {}".format(usr[0],usr[1],usr[2]))
def send_val():
usr = input("Username: ")
# Consider "datos" as the value of user input.
data_send(usr)
send_val()