Ser1ousSAM

strip enters

Jul 9th, 2023
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. file_path = 'Descriptions.txt'
  2. with open(file_path, 'r', encoding="utf8") as file, open('Strip_descriptions.txt', 'w', encoding="utf8") as new_file:
  3. count = 1
  4. for line in file:
  5. #27 - количество строк описания объявления
  6. if count % 27 != 0:
  7. line = line.strip()
  8. line = line.replace('\n', '') # Удаляем символы перехода строки
  9. new_file.write(line)
  10. count += 1
  11. elif line=='\n':
  12. count = 1
  13. new_file.write('\n')
  14. print("Nice")
Advertisement
Add Comment
Please, Sign In to add comment