ANTICHAT

ANTICHAT (https://forum.antichat.xyz/index.php)
-   Общие вопросы программирования (https://forum.antichat.xyz/forumdisplay.php?f=206)
-   -   Помощь в скрипте (https://forum.antichat.xyz/showthread.php?t=1492499)

viletto68 21.10.2023 21:31

как сделать так чтобы скрипт искал все .txt файлы на рабочем столу и потом выдал их список?

ukiru 22.10.2023 10:22

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

bulba$h 22.10.2023 11:35

Python:





Код:

import
glob
# тут укажи свой путь
path
=
"/путь/до/рабочего/стола"
# ищем файлы на рабочем столе
txt_files
=
glob
.
glob
(
path
+
"/*.txt"
)
# выводим список найденных файлов
for
file
in
txt_files
:
print
(
file
)



Время: 16:30