如何在python中从给定路径剪切驱动器名
在python中,我想从给定路径中剪切驱动器名如何在python中从给定路径剪切驱动器名,python,Python,在python中,我想从给定路径中剪切驱动器名 Example: if path given is D:\John\myfolder\newfolder then I should get John\myfolder\newfolder 请告诉我怎么做?我正在尝试使用os.path.abspath(path),但无法使用…: 你可以用切片 >>> path = r"D:\John\myfolder\newfolder" >>> print(path[3:])
Example:
if path given is D:\John\myfolder\newfolder
then I should get John\myfolder\newfolder
请告诉我怎么做?我正在尝试使用os.path.abspath(path),但无法使用…:
你可以用切片
>>> path = r"D:\John\myfolder\newfolder"
>>> print(path[3:])
John\myfolder\newfolder
>>> path = r"D:\John\myfolder\newfolder"
>>> print(path[3:])
John\myfolder\newfolder