ich möchte in einem String nach der Anzahl des Vorkommens eines Backslashs "\" suchen.
Code: Alles auswählen
sub='\'
mystring = "Anton ist \\doof"
print mystring.count(sub)
Code: Alles auswählen
File "test.py", line 3
sub="\"
^
SyntaxError: EOL while scanning string literal
Vielen Dank und ein schönes Wochenende,
Andi