我是新来的,总体上说是ding。 我正试图从一个文本档案中读到,每个线上都有路标。 我想逐行读到文本档案线,把线体分为驾驶、行道和档案名称。
我的法典是:
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 %s and file is %s % (drive, path, file))
我有以下错误:
File "C:/Users/visc/scratch/simple.py", line 14, in <module>
(drive,path,file) = os.path.split(line)
ValueError: need more than 2 values to unpack
当我只想走路和写上名字时,我不会收到这一错误。