Splitting path strings into drive, path and file name parts
问题 I am new to python and coding in general. I am trying to read from a text file which has path names on each line. I would like to read the text file line by line and split the line strings into drive, path and file name. Here is my code thus far: import os,sys, arcpy ## Open the file with read only permit f = open('C:/Users/visc/scratch/scratch_child/test.txt') for line in f: (drive,path,file) = os.path.split(line) print line.strip() #arcpy.AddMessage (line.strip()) print('Drive is %s Path is