-3

How can i replace ("\") with ("/") in python?

a = ("Hello/World")
b = a.replace("/","\")
print(b)

i was expected that i'll successfully replace but i'm getting an error EOL error

1 Answers1

1

Try this:

a = ("Hello/World")
b = a.replace("/","\\")
print(b)

Output:

Hello\World
YusufUMS
  • 1,421
  • 1
  • 10
  • 23