Обновить script.py
This commit is contained in:
parent
1a1f27f535
commit
6510c4643f
27
script.py
27
script.py
@ -1,24 +1,5 @@
|
|||||||
with open("data.txt", "r", encoding="utf-8") as file:
|
with open("data.txt", "r", encoding="utf-8") as infile:
|
||||||
lines = file.readlines()
|
lines = infile.readlines()
|
||||||
|
|
||||||
numbers = []
|
with open ("output.txt" ,"w" encoding="utf-8" as outfile:
|
||||||
words = []
|
outfile.writelines(transformed_data)
|
||||||
|
|
||||||
for line in lines:
|
|
||||||
line = line.strip()
|
|
||||||
if line.isdigit():
|
|
||||||
numbers.append(line)
|
|
||||||
else:
|
|
||||||
words.append(line)
|
|
||||||
|
|
||||||
|
|
||||||
with open("output.txt", "w", encoding="utf-8") as output_file:
|
|
||||||
output_file.write("Слова:\n")
|
|
||||||
for word in words:
|
|
||||||
output_file.write(word + "\n")
|
|
||||||
|
|
||||||
output_file.write("\nЧисла:\n")
|
|
||||||
for number in numbers:
|
|
||||||
output_file.write(number + "\n")
|
|
||||||
|
|
||||||
print("Файл output.txt успешно создан!")
|
|
||||||
|
Loading…
Reference in New Issue
Block a user