4 ответов
+ 6
Single quotes nested double quotes , double quotes nested in single quotes also works as expected. Ex:
print( 'This is double quotes: " Symbol' )
print("This is single quotes: ' symbol")
or
you can use escape character \ like :
print( "This is double quotes: \" Symbol" )
print('This is single quotes: \' symbol')
+ 5
You can nest double quotes inside single quotes:
print('"My love is thine to teach. Teach it but how, and thou shalt see how apt it is to learn. Any hard lesson that may do thee good."')
+ 5
# In Python you can make a string between single or double quotes
print ('hello')
print ("hello")
#To use a single quote inside a string with single quotes use backslash \' escape sequence
print('let\'s go')
# the same for double quotes
print("hello \"world\"")
# or simply
print("let's go")
print('hello "world"')
0
shakespeare_quote = "All the world's a stage, and all the men and women merely players."
print(shakespeare_quote)
shakespeare_quote = 'To be or not to be, that is the question.'
print(shakespeare_quote)