Can we use a variable to create a new variable in Python?

Viewed 23

I am wondering if we can use a variable name in order to create a new variable, for example:

Let's assume I have this variable:

 Var = 'Jim'

Lets say I want to concatenate the variable with a string, in this case the string is the word Mr:

 NewVar = "String"Var

So that if I print the new variable, the output would look something like:

 MrJim

This can be achieved in bash like this:

 NewVar=Mr${Var}

But I have not found a way to do this in Python. Please let me know if you know how to do it.

1 Answers
Related