Facebook
From Ronalds Mazitis, 1 Year ago, written in Python.
Embed
Download Paste or View Raw
Hits: 149
  1. #!/usr/bin/python3
  2.  
  3.  
  4. # list to store file lines
  5. lines = []
  6. # read file
  7. with open(r"/home/ronalds/Desktop/SS.txt", 'r') as fp:
  8.     # read an store all lines into list
  9.     lines = fp.readlines()
  10.  
  11. # Write file
  12. with open(r"/home/ronalds/Desktop/SS.txt", 'w') as fp:
  13.     # iterate each line
  14.     for line, words in enumerate(lines):
  15.         # delete line 5 and 8. or pass any Nth line you want to remove
  16.         # note list index starts from 0
  17.         if all(c not in words for c in ['$', '€']):
  18.             fp.write(line)
  19.