I'm using python3.6 for automatically finding some files in my computer:
import os
criteria = 'something'
file_names = os.popen('find dir -name "*%s*"' % criteria).read()
for file_name in file_names:
#do something
pass
The problem is that by doing .read(), all the file names including some criteria is concatenated into one string. How can I get a list of file names as output in order to iterating in the 'for' loop? Thanks a lot