Hello. I am relatively new to Python, so please bear with me. If my question is unclear, let me know. Thank you in advance.
I have a series of short files with a two unnecessary lines in them: ---, and old_path: /path/here/. There are multiple instances of --- in the files - I only want to delete the instance of it above old_path. Alternatively, I can delete the --- under the path under old_path... The idea is to delete one instance of the ---, and the old_path line. The rest of the content should remain as-is.
Example content:
_model: redirect
---
old_path: /path/here/
---
new_path: /path/to/directory/here/
---
_discoverable: no
Can Python delete these specific lines? Or is this a situation where I need to parse the file, redo the content without those lines in it, and rewrite the file with the new content?