首页 > 解决方案 > 读取地图文件

问题描述

这段代码有什么问题?显示未找到模块错误。

代码:

data_dir = 'D://ob//Imag'
mapfile = os.path.join(data_dir,'map.txt')

# Read the mapfile:
with open(mapfile,'r') as fp:
    
    mp = (
        st.strip().split('  ')\
        for st in fp.readlines()
    )
    
    fixpath = lambda x: os.path.abspath(os.path.join(data_dir,x))
    mp = [
        (fixpath(x[0]), fixpath(x[1]))\
        for x in mp
    ]

label_map_dict = label_map_util.get_label_map_dict('D://ob//Imag//abc.pbtxt')

错误:

FileNotFoundError                         Traceback (most recent call last)
<ipython-input-39-96f2621dd3fd> in <module>()
      3 
      4 # Read the mapfile:
----> 5 with open(mapfile,'r') as fp:
      6 
      7     mp = (

FileNotFoundError: [Errno 2] No such file or directory: 'D://ob//Imag/map.txt'

标签: pythonmap-files

解决方案


推荐阅读