This site is developed to XHTML and CSS2 W3C standards.
If you see this paragraph, your browser does not support those standards and you
need to upgrade. Visit WaSP
for a variety of options.
Paste #677
Posted by: Mr Rep
Posted on: 2026-04-20 06:35:05
Age: 9 hrs ago
Views: 4
start = int(input("Начало(например 100001): "))
end = int(input("Конец(например 999999): "))
words_file = input("Словарь: ")
output_file = input("Сохранить: ")
def read_words(filename):
for enc in ("utf-8", "cp1251", "latin-1"):
try:
with open(filename, "r", encoding=enc) as f:
return [line.strip() for line in f if line.strip()]
except UnicodeDecodeError:
continue
raise Exception("ERROR")
words = read_words(words_file)
with open(output_file, "w", encoding="utf-8") as out:
buffer = []
for number in range(start, end + 1):
for word in words:
line = f"{number};{word}"
print(line)
buffer.append(line + "\n")
if len(buffer) > 10000:
out.writelines(buffer)
buffer = []
if buffer:
out.writelines(buffer)
print("Готово!")
Download raw |
Create new paste