小册名称:Python合辑4-130个字符串操作示例
如果是 Python 中的反斜杠,则删除最后一个字符
x = 'Canada\\'print(x.rstrip('\\'))
x = 'Canada\\'
print(x.rstrip('\\'))
Output:
Canada