I have a .txt file in which the content are of this type:
DIRN straight-2
FOR minutes-5
DO crossing-6
WHAT Hall-7-13
DO take-10
WHAT Hall-3-15
What I want is another .txt file that can be generated with the help of python which will have this as its final content:
DIRN straight
FOR minutes
DO crossing
WHAT Hall-7
DO take
WHAT Hall-3
ie, I want to remove everything that comes after the last hyphen "-" in each line including hyphen also.
Please help me with the python code and thanks for any help in advance.