+ 14

How can I print a sentence quote with the quotation marks untouched?

eg; a string with an output with it's quotes untouched "hello world".

14th Sep 2020, 6:50 PM
Jordan Alloy ✝️
Jordan Alloy ✝️ - avatar
32 Respostas
+ 10
print(' "hello world" ')
14th Sep 2020, 6:52 PM
Oma Falk
Oma Falk - avatar
+ 10
if you want to include the quote character " inside of a string? If you try to execute print("I said "Wow!" to him") this will give error. the problem is that Python sees one string "I said "followed by something Wow! which is not in the string. This is not what we intended! Python does have two simple ways to put quote symbols in strings. You are allowed to start and end a string literal with single quotes (also known as apostrophes), like 'blah blah'. Then, double quotes can go in between, such as 'I said "Wow!" to him.' You can put a backslash character followed by a quote (\" or \'). This is called an escape sequence and Python will remove the backslash, and put just the quote in the string. https://code.sololearn.com/cny1a64d9ryd/?ref=app
14th Sep 2020, 7:16 PM
SOUMYA
SOUMYA - avatar
+ 5
use your brain please 😡😡
14th Sep 2020, 7:03 PM
Oma Falk
Oma Falk - avatar
+ 5
Jordan Alloy😂 if I tell u a bit harsh to use your brain, I desperately try to teach you. And I have confidence that u find the solution. In my eyes you are a bit lazy. It is a kick in your .... you know. 😉
14th Sep 2020, 7:11 PM
Oma Falk
Oma Falk - avatar
+ 5
print(' "hello world" ') (quotation)
15th Sep 2020, 9:40 AM
Psͥycͣhͫ๏F̶
Psͥycͣhͫ๏F̶ - avatar
+ 5
G'day Jordan Alloy😂. You should go back and have a look at the very first batch of Python modules in Basic Concepts. The lessons under the Strings module cover the "Escape Characters" SOUMYA SAHU is talking about, as well as what Oma Falk was saying.
15th Sep 2020, 11:03 AM
Mark McClan
Mark McClan - avatar
+ 3
print(repr("hello'world"))
15th Sep 2020, 6:05 PM
Subhash
Subhash - avatar
+ 2
Oma Falk look if your not interested in teaching me I suggest you just avoid my questions. No one learn the way your coming off man!
14th Sep 2020, 7:07 PM
Jordan Alloy ✝️
Jordan Alloy ✝️ - avatar
+ 2
~ swim ~ thanks man, got it now. One love
14th Sep 2020, 7:08 PM
Jordan Alloy ✝️
Jordan Alloy ✝️ - avatar
+ 2
Oma Falk you can say what you want bro, am trying to make use of my little resources to achieve great results, so don't tell me am lazy. You obviously don't know why I registered all those courses, and you don't know why my learning is progressive. I'll take your insults as a credit bro, this place is filled with different people. Using your limited perception on someone is wrong.
14th Sep 2020, 7:14 PM
Jordan Alloy ✝️
Jordan Alloy ✝️ - avatar
14th Sep 2020, 7:22 PM
Jordan Alloy ✝️
Jordan Alloy ✝️ - avatar
+ 2
Jan Markus thanks bud, learnt it. 👼🍾
14th Sep 2020, 7:53 PM
Jordan Alloy ✝️
Jordan Alloy ✝️ - avatar
+ 2
Mark McClan done the review already, i totally understand now. Thanks for your replies.
15th Sep 2020, 1:25 PM
Jordan Alloy ✝️
Jordan Alloy ✝️ - avatar
+ 2
15th Sep 2020, 1:26 PM
Jordan Alloy ✝️
Jordan Alloy ✝️ - avatar
+ 2
print(“\”hello world\””)
15th Sep 2020, 4:32 PM
Satvik Virmani
Satvik Virmani - avatar
+ 2
print ("\"write sentence\" ")
16th Sep 2020, 5:26 AM
Meenakshi Narayan
Meenakshi Narayan - avatar
+ 2
You can also use triple single or triple double quotes. print(""" "Hello" 'World!' """) output: "Hello" 'World!'
16th Sep 2020, 5:30 AM
Fasih Raza
+ 2
Use the escape sequence \" for printing the quotes, so that it will not be formatted.
16th Sep 2020, 8:54 AM
Amal Prabhakaran
Amal Prabhakaran - avatar
+ 2
print("\"Hello World\" ")
16th Sep 2020, 1:23 PM
Ravi Teja
Ravi Teja - avatar
+ 1
Oma Falk wow, i have spent time trying to make that possible. Thanks 😊
14th Sep 2020, 6:55 PM
Jordan Alloy ✝️
Jordan Alloy ✝️ - avatar