title: How can I parse this text which is in column format, in python script to give specific output
body: <p>I am a newbie in python scripting and trying to parse the below command output which is in column format, to show :</p>
  
  <p>Text to be parsed:</p>
  
  <pre><code>    Neighbor        V           AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
  10.0.10.101     4         1024      80      87        1    0    0 01:17:25        0
  10.0.11.101     4         1024      92      91        1    0    0 down        0
  </code></pre>
  
  <p>Output format:</p>
  
  <pre><code>Neighbor:10.0.10.101 is up
  Neighbor:10.0.11.101 is down
  </code></pre>
  
  <p>Edit - 1
  Thanks for your suggestion, the code I mentioned in my earlier comment is dynamic output from a command in cisco switch, this is my code below, when I run this script, it needs to dynamically read the output which is in column format and show me if neighbor is up or down, so the neighbor status is not constant it will be changing from up or down, if it is up then time (example - 01:17:25) will be shown or if it is down string ‘down’ will be shown in output</p>
  
  <pre><code>from __future__ import print_function
  from netmiko import ConnectHandler
  
  import sys
  import time
  import select
  import paramiko
  import re
  status = open(r'E:\\Python-Scripts\\bgp-status.txt','w')
  old_stdout = sys.stdout
  sys.stdout = status
  host = '10.0.10.100'
  platform = 'cisco_ios'
  username = 'javed'
  password = 'cisco'
  device = ConnectHandler(device_type=platform, ip=host, username=username, password=password)
  output = device.send_command('terminal length 0')
  output = device.send_command('enable')
  bgp_status = device.send_command('show ip bgp summary | be N')
  
  
  for neighbor_status in bgp_status.split('\n'):
      if 'down' in neighbor_status:
          print(f"{neighbor_status} is down")
      else:
          print('All neighbors are up')
          break
  status.close()
  </code></pre>