My txt file looks something like this:
Destination: Test 5
lines = open("branch_dest.txt").readlines() lines=[x.split() for x in lines] print lines branch = "%s" % lines.strip(': ') print branch destination = "%s" % lines.strip(': ') print destination
I need to extract the branch name and the destination. But i get the below output.
[['Branch:', 'ltm_7.4'], ['Destination:', 'Test', '5']]
Branch is ok. But the destination needs to be Test 5. Kindly help as i am new to Python.