How to edit Text Files with Python | Beginners Tutorial
Автор: Trying to learn...
Загружено: 2025-09-29
Просмотров: 69
import os
list_files = os.listdir(".")
list_text = [i for i in list_files if i.endswith(".txt")]
print(list_files)
print(list_text)
new_files = ["text.txt", "text2.txt", "text3.txt", "text4.txt"]
for file in new_files:
with open(file, "w"):
pass
with open(file, "r+") as text:
text.write("hello world")
text.seek(0)
print(text.read())
with open("new file") as text:
print(text.txt)
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: