-2

enter image description here is there a way to print single backslash within list?

khelwood
  • 55,782
  • 14
  • 81
  • 108

1 Answers1

-1

Regarding the first version of your question, I wrote this:

  1. 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.

  2. 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