Jul-17-2018, 01:47 PM
Hello!
I wanted to know if it is possible to create a command on Python based on the input.
In the program I ask the user to choose a number between 1 and 871 and if he chooses the number N then i will launch the command
Do you have any idea?
Thank you
I wanted to know if it is possible to create a command on Python based on the input.
In the program I ask the user to choose a number between 1 and 871 and if he chooses the number N then i will launch the command
c_N.writerow(result)I could do something like that:
x=input("Entrer le numéro correspondant") if x=1: c_1.writerow(result) elif x=2: c_2.writerow(result) .... .... .... elif x=871: c_871.writerow(result) else: print("You wrote the wrong number")But it would take way to much time. I was thinking of a function that could "launch" a line depending of the string in input. Like that:
Quote:x=input("Entrer le numéro correspondant")
x="c_"+x
execute(x,".writerow(result))
Do you have any idea?
Thank you