[Solved] In Python find and extract only required info [closed]


>>> data = """
============================
coaza077-cor-01> show module

 Status and Counters - Module Information
  Chassis: 2900-24G J9049A         Serial Number:   SG748KI09F
  Slot  Module Description                       Serial Number
  ----- ---------------------------------------- --------------

coaza077-cor-01> exit
Do you want to log out [y/n]? y
=============================
"""
>>> chasis = data.split('Chassis:')[1].split('Serial')[0].strip()
>>> serial = data.split('Serial Number:')[1].split()[0].strip()
>>> 
>>> print chasis
2900-24G J9049A
>>> print serial
SG748KI09F

Update for comment:

>>> x, y = chasis.split()
>>> print x
2900-24G
>>> print y
J9049A

2

solved In Python find and extract only required info [closed]