Oct-25-2020, 02:12 PM
The extremely dangerous way to do it is the exec() function. You are opening up your machine to the user, but here's an example
cmd = input('What do you want to do?') print(f'You want to {cmd}') exec(cmd)
Output:What do you want to do?print('foo bar')
You want to print('foo bar')
foo bar