Python converting '\' to '\\'

后端 未结 5 1228
耶瑟儿~
耶瑟儿~ 2021-01-27 16:46

I am writing a program to sort a list fo input strings (song names). Those songnames contains latex chars like $\\lambda$, which i want to get sorted like \'lambda\' instead, s

5条回答
  •  不知归路
    2021-01-27 17:10

    But for some reason, when i append the lambda sign or \her it converts it to \\her or $\\lambda$...

    No it doesn't. What you're seeing is the representation, which always doubles solo backslashes for clarity. If you print the actual strings instead you'll see that they're fine.

提交回复
热议问题