0

What is the difference between single and double quotes while printing anything in python

When I write print('hello') python compiler executes it And also when I write ("World") then also it executes the line

5th Apr 2018, 6:51 PM
Sankalp Boradkar
Sankalp Boradkar - avatar
3 odpowiedzi
+ 1
It doesn't make difference in such small scale but it's recommend you use double quotes. you can use single quotes on a string if you need to add quotes into the string ex. example = 'he said "lol" and laughed' but even in these cases you could use triple double quotes which allow you to use both single and double quotes in a string. example = """hello this is a "quote" with 'single' quotes"""
5th Apr 2018, 6:55 PM
Markus Kaleton
Markus Kaleton - avatar
0
got it, thanks :)
5th Apr 2018, 6:57 PM
Sankalp Boradkar
Sankalp Boradkar - avatar
0
String: single or double quote Though both are permitted in Python, but it's more wise to use " " , because it supports to use apostrophe ( ' ) with a word.For example -print("John\'s book") >>> John's book
5th Apr 2018, 7:21 PM
📈SmileGoodHope📈
📈SmileGoodHope📈 - avatar