Python – Create a string using double quotes
To create a string using double quotes in Python, enclose the required string value or sequence of characters in double quotes.
For example, consider the following string created using double quotes.
We can assign this string value to a variable, say x, as shown in the following.
x = "hello world"
We can use the string literal in an expression, say concatenation of two strings.
"hello world" + "apple"
Since we defined the string using double quotes, if we would like to use a double quote inside this string, we must escape the double quote using backslash character.
Python Example to create a string using double quotes
In the following program, we create a string using double quotes, assign the string to a variable, and print the string to standard console output.
In the following video tutorial, you shall learn how to create a string in Python with well detailed explanation and examples.
In this tutorial, we have seen how to create a new string value using double quotes in Python, with well detailed examples.