In this Python string tutorial, you will learn how to convert a string to a variable name in Python.
# Create a string S = "Ai Hints" # Convert string into variable name V = S.replace(" ", "_") # Print variable name print(V) # Display the type of V print(type(V))
Output:
Ai_Hints <class 'str'>