Discuss / Python / 练习1

练习1

Topic source

米粽粽

#1 Created at ... [Delete] [Delete and Lock User]
import os
def dl():
    dir = []
    file = []

    for x in os.listdir():
        if os.path.isdir(x):
            dir.append(x)
        elif os.path.isfile(x):
            file.append(x)

    for d in dir:
        print(d)
    for f in file:
        print(f)

  • 1

Reply