How does python handles " in a string when \ is not provided?
(Source/Credits: https://dev.to/farzanrashid/how-does-python-handles-in-a-string-when-is-not-provided-4i8b)
I am a beginner in python. I knew that " is a special character and needs \ to print it. But how does...
I am a beginner in python. I knew that " is a special character and needs \ to print it. But how does python handles " in a string when \ is not provided? For example
s = "Google," "facebook"
print(s)
prints "Google,facebook". How does python skips the middle "?
Comments section
aadibajpai
•May 1, 2024
In this example, the strings get concatenated. Also, you don't necessarily need \ to escape ". You could also do
s = 'Google," facebook'
and the " would be printed normally.goyo
•May 1, 2024
In this case you actually have two strings which are concatenated with each other. See related part of Python docs.