当前位置: 首页>>代码示例>>Python>>正文


Python Search.parse方法代码示例

本文整理汇总了Python中Search.parse方法的典型用法代码示例。如果您正苦于以下问题:Python Search.parse方法的具体用法?Python Search.parse怎么用?Python Search.parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Search的用法示例。


在下文中一共展示了Search.parse方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: write

# 需要导入模块: import Search [as 别名]
# 或者: from Search import parse [as 别名]
def write():

    
    #first finger scan
    setBaud()    
    data = genImg.getHeader()
    ser.write(bytearray(data));
    time.sleep(1)
    s = ser.read(ser.inWaiting())
    print([hex(ord(c)) for c in s])
    genImg.parse(s)
    # generate character file of the finger image.
    setBaud()
    data = Img2Tz.getHeader(0x01)
    ser.write(bytearray(data));
    time.sleep(1)
    s = ser.read(ser.inWaiting())
    print([hex(ord(c)) for c in s])
    Img2Tz.parse(s)

    setBaud()
    data = Search.getHeader(0x01, 0x0000, 0x0064)
    ser.write(bytearray(data));
    time.sleep(1)
    s = ser.read(ser.inWaiting())
    print([hex(ord(c)) for c in s])
    print Search.parse(s)
开发者ID:girish946,项目名称:python3-R305,代码行数:29,代码来源:Verify.py

示例2: countyMapperMenu

# 需要导入模块: import Search [as 别名]
# 或者: from Search import parse [as 别名]
def countyMapperMenu(caches):
    #Filters caches given by BC, then tries to assign them to a regional district of BC.
    
    #Menu to choose province
    print "Will search BC Caches and try to assign counties"
    
    #get caches in BC currently without a county
    (options, args, search) = Search.parse('-s "British Columbia" -O C', False)
    cacheList = Search.parseOptions(caches, options)
    
    #write these caches to a file
    filename = writeCountyMapper(cacheList)
    
    BCPolygons = ['BC/Alberni-Clayoquot.arc', 'BC/Bulkley-Nechako.arc', 'BC/Capital.arc',
                'BC/Cariboo.arc', 'BC/Central Coast.arc', 'BC/Central Kootenay.arc', 
                'BC/Central Okanagan.arc', 'BC/Columbia-Shuswap.arc', 'BC/Comox Valley.arc', 
                'BC/Cowichan Valley.arc', 'BC/East Kootenay.arc', 'BC/Fraser Valley.arc', 
                'BC/Fraser-Fort George.arc', 'BC/Greater Vancouver.arc', 'BC/Kitimat-Stikine.arc',
                'BC/Kootenay Boundary.arc',  'BC/Mount Waddington.arc', 'BC/Nanaimo.arc', 
                'BC/North Okanagan.arc', 'BC/Northern Rockies.arc', 'BC/Okanagan-Similkameen.arc',
                'BC/Peace River.arc', 'BC/Powell River.arc', 'BC/Skeena-Queen Charlotte.arc',
                'BC/Squamish-Lillooet.arc', 'BC/Stikine.arc', 'BC/Strathcona.arc', 
                'BC/Sunshine Coast.arc', 'BC/Thompson-Nicola.arc']
    #call GPSBabel to filter these caches through each polygon, then remove temp files
    gcids = {}
    for polygonName in BCPolygons:
        callPolygonFilter(filename, polygonName, "test.out")
        gcids.update(readCountyMapper(os.path.join(os.getcwd(), 'test.out'), polygonName[3:-4]))
        os.remove("test.out")
        if len(gcids) > 0:
            log.info("%s has caches" %(polygonName[3:]))
        else:
            log.info("%s does not have caches" %(polygonName[3:]))
    os.remove(filename)
    
    #save county name to caches
    for cache in cacheList:
        if cache.gcid in gcids.keys():
            cache.county = gcids[cache.gcid]
        else:
            log.error("%s was not found in a BC Regional District despite being in BC" %cache.gcid)
    return
开发者ID:alarobric,项目名称:geocachepython,代码行数:44,代码来源:countyMapper.py


注:本文中的Search.parse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。