What's the difference between single quotes (') and double quotes (") in Python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What's the difference between single quotes (') and double quotes (") in Python?

In Python, we see 2 types of quotes i.e. single qoutes (') and double quotes ("). What's the difference between them? Also, want to know as to where single quotes (') and double quotes (") are used.

10th Jul 2017, 8:19 AM
Shibnath Maji
Shibnath Maji - avatar
2 Answers
+ 4
They're identical. If your string contains 1 ore more double quotes, you can use single quotes to surround it and vice versa: a = 'Hello "World"!' print (a) b = "Hello 'World'!" print (b)
10th Jul 2017, 8:43 AM
Bàng Tứ Cường
Bàng Tứ Cường - avatar
- 1
its recommended you use doubles but they do the same thing, double quotes allow the use of ' and singles allow the use of " . but i myself normally use triple double quotes for strings containing quotations """ string """
1st Mar 2018, 10:39 PM
Markus Kaleton
Markus Kaleton - avatar