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
As already suggested you should escape your backslash:
'$\\lambda$'
Another alternative is to use raw strings, which are not subject to special character substitution:
r'$\lambda$'
When you have many backslashes raw strings tend to be clearer.