Python: how to make form a string comprising of text and variable values in python 2.6 -


Actually I want to add strings and variables together.

In Java:

  string is s = "HI is my name" + var_name + "i" + age + "old of year";   

In PHP:

  $ s = "Hi my name". $ Var_name "I'm" $ age "Years old";   

I need a similar thing in Python. I know the format function supported by Python 3.0 and above but there is a hindrance to running Python version 2.6. I can not upgrade, please tell me the best method.

PS - I came to know that the format also works in Python 2.6. If you have any other way, please tell me also. Always good for more information.

.format :

  " Hi my name {name}. I'm {age} year old. " Format (name = "John", age = 30)    

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -