zoukankan      html  css  js  c++  java
  • Python 中glob模块使用

    1.介绍
    glob模块用来查找文件目录和文件,常见的两个方法有glob.glob()和glob.iglob(),可以和常用的find功能进行类比,glob支持*?[]这三种通配符

    2.三种通配符


    *代表0个或多个字符
    ?代表一个字符
    []匹配指定范围内的字符,如[0-9]匹配数字

    3.例子

    import glob
    filelist=glob.glob('*.py')
    print(filelist)
    for py in filelist: 
        print(py) 

    output:

    ['eval.py', 'evaluator.py', 'eval_util.py', 'eval_util_test.py', 'exporter.py', 'exporter_test.py', 'export_inference_graph.py', 'generate_tfrecord.py', 'inputs.py', 'inputs_test.py', 'model_hparams.py', 'model_lib.py', 'model_lib_test.py', 'model_main.py', 'model_tpu_main.py', 'Object_detection_image.py', 'Object_detection_video.py', 'Object_detection_webcam.py', 'resizer.py', 'train.py', 'trainer.py', 'trainer_test.py', 'xml_to_csv.py', '__init__.py']
    eval.py
    evaluator.py
    eval_util.py
    eval_util_test.py
    exporter.py
    exporter_test.py
    export_inference_graph.py
    generate_tfrecord.py
    inputs.py
    inputs_test.py
    model_hparams.py
    model_lib.py
    model_lib_test.py
    model_main.py
    model_tpu_main.py
    Object_detection_image.py
    Object_detection_video.py
    Object_detection_webcam.py
    resizer.py
    train.py
    trainer.py
    trainer_test.py
    xml_to_csv.py
    __init__.py
  • 相关阅读:
    生病了,难受啊
    2005年1月31号随笔一篇
    [转]永远的Beyond
    关于IE问题,请教和求救
    中国财富排行榜
    这两天简直倒霉透顶了
    Asp.net(C#)给图片加上水印效果
    我不爱的那个女人
    555,我的hotmail从2G变回2M的了
    怀念永远的战神
  • 原文地址:https://www.cnblogs.com/4c4853/p/9782075.html
Copyright © 2011-2022 走看看