python 处理字符转

17 阅读1分钟

python 删除某个字符串

        name ="/home/alex/image.jpg"
        path = '/home/alex'
        name = name.replace(path, '')
        name = name.replace(".jpg", '')
        print(name)