Reputation: 85
I have a file with many lines like this:
...
Model Path/IOSU/SIQER/Instruments/Sca/Breaking element/voltageZ/Out
Model/BDP/Simulator Replica/KO30_V/Value
...
I need to find out the next last value within the delimiter "/". Ex for these two lines it should be: "voltageZ" and "KO30_V".
Ex:
with open('tt.txt') as fp:
for line in fp:
temp = #remove all after the last '/'
temp = #remove all before the next last '/'
print temp
This should print out:
voltageZ
KO30_V
How to do this? Could I use split for this? I'm using Python 2.7
Thx!
Upvotes: 0
Views: 18