enter image description here is there a way to print single backslash within list?
Asked
Active
Viewed 29 times
-2
-
[Please do not upload images of code/data/errors when asking a question.](//meta.stackoverflow.com/q/285551) – Karl Knechtel Aug 07 '22 at 03:52
1 Answers
-1
Regarding the first version of your question, I wrote this:
First, this expression
x='\'
isn't right in Python in python. you should rather puth it this way:x='\\'
, since back slash is a special character in python.Second, try this:
l=['\\'] print(l)
This will print:['\\']
But when you execute this:
print(l[0])
, it renders this'\'
. So basically, this['\\']
is the way to print a backslash within a list.

Abdel
- 139
- 17