I have created a small learning circle for Python learning to provide a platform for everyone to discuss learning Python together. Python is the future, and it is challenging our analytical abilities and the way we perceive the world, so we need to keep up with the changes, and grow. Mastering Python’s core technology is the real value of mastering it.

delete

new

copy

mobile

rename

Path to the relevant

Directory traversal

Two ways:

os.walk()

OS. Listdir () recursion

os.walk

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

Parameter 1: The directory to traverse

Parameter 2: Defaults to True for breadth traversal and False for depth traversal

Parameter 3: nullable, callable object that is called when walk fails

Parameter 4: null, if True, it will traverse the directory shortcuts (Linux is symbolic link) the directory actually referred to (default closed) finally, if you are not very tight time, and want to quickly improve, the most important is not afraid of hard work, you can contact dimension: 762459510, that is really very good, many people progress very quickly, need you not afraid to bear hardships oh! You can go to add a look at ~

OS. Listdir recursion

os.listdir(path)

Parameter 1: directory

Returns the names of folders and filenames in the path directory in alphabetical order