Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- file_path = 'Descriptions.txt'
- with open(file_path, 'r', encoding="utf8") as file, open('Strip_descriptions.txt', 'w', encoding="utf8") as new_file:
- count = 1
- for line in file:
- #27 - количество строк описания объявления
- if count % 27 != 0:
- line = line.strip()
- line = line.replace('\n', '') # Удаляем символы перехода строки
- new_file.write(line)
- count += 1
- elif line=='\n':
- count = 1
- new_file.write('\n')
- print("Nice")
Advertisement
Add Comment
Please, Sign In to add comment