- 5

Strings

Some characters can't be directly included in a string. For instance, double quotes can't be directly included in a double quote string; this would cause it to end prematurely. Can someone explain and give an example of the meaning of this?

5th Sep 2019, 7:23 PM
i XL
i XL - avatar
12 Respostas
+ 13
If you do print(" " hi" ") it will give you error. But you can do print(" 'hi' ") or print(' "hi" ')
5th Sep 2019, 7:25 PM
🍇 Alex Tușinean 💜
🍇 Alex Tușinean 💜 - avatar
+ 11
you can use the back-slash: print("\"hi\"")
5th Sep 2019, 7:28 PM
Anton Böhler
Anton Böhler - avatar
+ 4
" ": The string starts at " The string ends at the next " So if you do " " hi " " There are 2 empty strings and some unknown variable (hi) , causing error. The same thing with ' '
5th Sep 2019, 7:29 PM
🍇 Alex Tușinean 💜
🍇 Alex Tușinean 💜 - avatar
+ 2
đŸŒ· Alex Tusinean đŸ”„ and there is no operator between the Strings so that's an error source too
5th Sep 2019, 7:35 PM
Anton Böhler
Anton Böhler - avatar
+ 2
5th Sep 2019, 7:36 PM
🍇 Alex Tușinean 💜
🍇 Alex Tușinean 💜 - avatar
+ 2
You can use the back-slash and this is known as 'escaping special characters' Secondly, enclose you text in a pair of three apostrophes. Do as if you are doing documentation (like docustring). I have included an example of this code. https://code.sololearn.com/cY4L3JdzwmzV/?ref=app
14th Jul 2020, 11:53 PM
Lucky Sibanda
Lucky Sibanda - avatar
+ 1
String Jika Anda ingin menggunakan teks dengan Python, Anda harus menggunakan string. String dibuat dengan memasukkan teks antara dua tanda kutip tunggal atau ganda. Ketika konsol Python menampilkan stri
10th Nov 2019, 4:49 PM
Hendro Syahputro
Hendro Syahputro - avatar
+ 1
"\" "
26th Sep 2020, 9:34 AM
Kamran Ulhaq
Kamran Ulhaq - avatar
0
You can't be use same quote inside same quote like outside Ex ..you write ("my name is "yuwandeval" i m from delhi") if you write this you got error beacase whenever you compile the program compiler thought first quote is ("my ) this one but close of this quote is "yuwan deval..but it is not its close points soo...you got order... Solition is that you use quote inside different quote so you never get error example ("My name is 'yuwan deval' and i m form ' delhi' yeap ") Output. My name is ' yuwan deval ' and i m from ' delhi' yeap.
30th Jan 2020, 11:07 AM
Ujjwal Deval
Ujjwal Deval - avatar
0
I could not understand what is string
18th Apr 2020, 3:02 AM
Anuth Gowda1
0
Anuth Gowda1, a string is a set of characters placed in quotes. Perhaps read on data types for you to fully understand strings and what you can do or not do on them.
11th May 2020, 5:05 PM
Lucky Sibanda
Lucky Sibanda - avatar
0
Use back Slash to print \
31st Aug 2021, 7:03 AM
Payal Singh