zoukankan      html  css  js  c++  java
  • Python

    for (path,dirs,files) in os.walk(path):
        for filename in files:
            #do something here

    os. walk(top, topdown=True, onerror=None, followlinks=False)

      - Generate the file names in a directory tree by walking the tree either top-down or bottom-up. For each directory in the tree rooted at directory top (including top itself), it yields a 3-tuple (dirpath, dirnames, filenames).

    for i in os.listdir(os.getcwd()):
        if(os.path.isfile(i)):
            #do something here

    os.listdir(path)

       - Return a list containing the names of the entries in the directory given by path. The list is in arbitrary order. It does not include the special entries '.' and '..' even if they are present in the directory.

  • 相关阅读:

    快排
    排序算法
    运算符
    二叉树
    递归
    队列
    栈(没写完)
    绘制双坐标轴的图形3-不同的plot类型
    绘制双坐标轴的图形2-不同的plot类型
  • 原文地址:https://www.cnblogs.com/kiddy/p/5186545.html
Copyright © 2011-2022 走看看