Python - Printing Integer variable inside double quote [duplicate]

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Python - Printing Integer variable inside double quote [duplicate]



This question already has an answer here:



I have an integer variable in Python::



var = 10



I want to print it like this :



"10"



Tried many things like



' "var" '



but did not really work.



Any help would really be appreciated.
Thanks in advance.



This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.





You want to convert integer to string ?
– kvmahesh
May 23 at 13:21





Converting is easy, i dont really want to convert it, i want to display it with double quote like "10"
– Sankar
May 23 at 13:25




2 Answers
2



Use string format:


format


print('""'.format(var))
# "10"



Or:


print("""".format(var))
# "10"



Or:


print(f'"var"')
# "10"



Or:


print(f""var"")
# "10"



Convert your variable yo string. like below:


print(str(var))



EDIT: Print in "10" style:


print('""'.format(var))





It wouldn't be displaying output such as "10" It will only give 10 as a string value
– Sankar
May 23 at 13:23






You need to convert or just print "" symbols?
– Saeed
May 23 at 13:24





yes thank you so much @Saeed it worked, can you please not down vote it?
– Sankar
May 23 at 13:30





I didn't down vote, you up vote and approve answer if it helped you. :)
– Saeed
May 23 at 13:39

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard