Answer the question
In order to leave comments, you need to log in
Why are files with ._ beginning output, and how to remove their output?
Hello experts,
I have the following code:
#!/Library/Frameworks/Python.framework/Versions/3.9/bin/python3
import os
def files(path):
for file in os.listdir(path):
if os.path.isfile(os.path.join(path, file)):
yield file
for file in files("."):
print(file)
file.py
main.py
sorter.py
._sorter.py
Answer the question
In order to leave comments, you need to log in
Helped:
#!/Library/Frameworks/Python.framework/Versions/3.9/bin/python3
import os
def files(path):
for file in os.listdir(path):
if os.path.isfile(os.path.join(path, file)):
yield file
for file in files("."):
if '._' in file:
pass
else:
print(file)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question