python字符串操作

1、字符串操作':\' 替换为 '/'


https://blog.csdn.net/qq_38463737/article/details/106965958
'/'.join(str_path.split('\')) 
# 直接用str_path.displace('\', '//')在windows下会有问题,如果'/'后面时数字,还会存在转义的问题
path= "abc\123.jpg"
print(path)  #abc123.jpg
print(repr(path))  #abc\123.jpg
_path= '/'.join(path.split('\')) #_path= '//'.join(path.split('\'))
print(_path)  #abc/123.jpg
print(repr(_path))  #abc/123.jpg
原文地址:https://www.cnblogs.com/wllwqdeai/p/15021441.html