在python中使用pathlib函数传递路径的方法
1.首先,在在项目中定义需要传递的路径;
def f_path(path):my path will be : /Users/jame/Desktop/data-code/Testdata
def f_path(path):
my path will be : /Users/jame/Desktop/data-code/Testdata
2.传递路径定义好后,使用pathlib获取路径即可;
from pathlib import Pathhome = str(Path.home())path = home + "/Desktop/data-code/Testdata"
from pathlib import Path
home = str(Path.home())
path = home + "/Desktop/data-code/Testdata"