[Solved] Filtering files with python [closed]


This is basically the same as Levon’s answer, but slightly more compact and Pythonic, and with the numbers adjusted to a guess at what I suspect the OP is trying to do.

with open('data.txt') as inf:
  for lc, line in enumerate(inf):  # lc - current line count
    if lc >= 2: # netstat usually has 2 lines of header info
      print ' '.join(line.split()[3:5]) # cols 3-4 are the addresses

2

solved Filtering files with python [closed]