Просмотр полной версии : Помощь в скрипте
viletto68
21.10.2023, 21:31
как сделать так чтобы скрипт искал все .txt файлы на рабочем столу и потом выдал их список?
Find all files in a directory with extension .txt in Python
How can I find all the files in a directory having the extension .txt in python?
stackoverflow.com
получить путь к рабочему столу https://stackoverflow.com/questions/34275782/how-to-get-desktop-location
Python:
import
glob
# тут укажи свой путь
path
=
"/путь/до/рабочего/стола"
# ищем файлы на рабочем столе
txt_files
=
glob
.
glob
(
path
+
"/*.txt"
)
# выводим список найденных файлов
for
file
in
txt_files
:
print
(
file
)
vBulletin® v3.8.14, Copyright ©2000-2026, vBulletin Solutions, Inc. Перевод: zCarot