Sep-30-2017, 09:20 AM
(Sep-30-2017, 05:20 AM)pythonbabe Wrote: No Luck even after i changed as above.You should not get TabError with that code.
Test:
tofind = '<map>' tofind1 = '</map>' with open('in.txt') as my_file: for num, line in enumerate(my_file, 1): if tofind in line: print(f'{tofind} at line: {num}') if tofind1 in line: print(f'{tofind1} at line: {num}')
Output:<map> at line: 1
</map> at line: 5
<map> at line: 11
</map> at line: 16