S
S
soks_of_fate2021-06-08 20:04:17
Python
soks_of_fate, 2021-06-08 20:04:17

How to weed out filenames in python?

The task is as follows: there are a number of files with various names. Watch these files there is a file with the symbol "_". In a variable it is necessary to push a name of a file with this character. Judging by what I found on the Internet, the command looks like I indicated below.

import os

name=os.walk("_")
print(name)


But at the same time, instead of showing the names, it displays the line "generator object _walk at 0x0000027D5A97E6D0" Is this code structure appropriate? If yes, how to fix it? If "no", which one do you need?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question