Add Quotes to String in Python

  • Post category:String

In this article, you will see how to add quotes to string in Python. Quotes are used to mark the beginning and end of a string. If you want to add quotes to a string, you can use the repr() function to add quotes to a string.

Step 1: Create a string

str = "CodeAllow"
print("str = ", str)
print("str type = ", type(str))

Step 2: Add quotes

print("str = ", repr(str))


str =  CodeAllow
str type =  <class 'str'>
str =  'CodeAllow'

Free resources to learn advanced skills: AiHints and CodeAllow