Python os.walk() | List all the files and folders , search for strings in Files
Автор: Sandeep Rajakrishnan
Загружено: 2020-07-24
Просмотров: 7893
This video shows how you can list out all the files and folder names using python's os.walk() , and search for strings from multiple files from a folder using .endswith()
Like and subscribe for more content!
CODE:
import os
FILENAMES=[]
for root, dirs, files in os.walk(r".",topdown=False):
for filename in files:
if(filename.endswith(".c")):
FILENAMES.append(filename)
print(filename)
print('\n')
for FILENAME in FILENAMES:
print(FILENAME," contains the following functions:\n")
f1=open(FILENAME,'r')
for line in f1:
if ("void") in line:
print (line)
else:
pass
print('\n')
f1.close()
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: