Python converting '\' to '\\'

后端 未结 5 1149
耶瑟儿~
耶瑟儿~ 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:19

    The point is that you should use r'$\lambda$' moreover when you print the list it print a repr of each element to print

    you should do

    from __future__ import print_function
    print (*mlist)
    

提交回复
热议问题