Avatar ·

How to remove lines selectively?

📁 Advanced Python Topics, example

There is a file consisting of lines. It is necessary to selectively remove lines that start with a certain set of characters using Python. How to do this?

Here is an example

  atom  14  atom  15  anisou  15  atom  16  anisou  16   

You need to delete everything that begins with anisou