0
Can we use a single quotation in string? I can, What are the situations?
3 ответов
+ 8
Hi Omar You can use single or double quotes.
Here are situations where you would choose to use one or the other:
Example 1: 'He said, "See ya," and closed the door.' Example 2: "They said, 'We will miss you,' as he left."
Use both single and double quotes when you need to include quotes within quotes.
If you use single quotes, make sure to start and end with the same type, and the same applies to double quotes.
+ 5
Everyone can use single quote not only you
+ 1
Python is doesn't differ between a single quote or a double code in a string. The output will be the same, however, one thing that you need to be careful is that many other languages, make a difference between a single quote and a double quote. Make sure to not use a combination of both, as it can make the code hard to read.