I am reading a large text file in Python, which looks like the following (contains many Code and Description information).
Over-ride Flag for Site/Laterality/Morphology (Interfield Edit 42)
This field is used to identify whether a case was reviewed and coding confirmed
for paired-organ primary
site cases with an in situ behavior and the laterality is not coded right,
left, or one side involved, right or left
origin not specified.
Code Description
Blank Not reviewed, or reviewed and corrected
1 Reviewed and confirmed as reported: A patient had behavior
code of in situ and laterality is not
stated as right: origin of primary; left: origin of primary; or only one side
involved, right or left
origin not specified
This field is used to identify whether a case was reviewed and coding confirmed
for cases with a non-
specific laterality code.
Code Description
Blank1 Not reviewed
11 A patient had laterality
coded non-specifically and
extension coded specifically
This field, new for 2018, indicates whether a case was reviewed and coding
............
From the above free text I need to store only code and description values into two lists like following.
code = ["Blank", "1", "Blank1", "11"]
des = ["Not reviewed, or reviewed and corrected", "Reviewed and confirmed as reported: A patient had behavior code of in situ and laterality is not stated as right: origin of primary; left: origin of primary; or only one side involved, right or left origin not specified", "Not reviewed", "A patient had laterality coded non-specifically and extension coded specifically"]
How can I do it in Python?
Note: The Code can contain a "Blank (or Blank1)" keyword or a numeric value. Sometimes code Description is fragmented in multiple lines. In the above example, I am showing that one Code and Description block contains two codes and two descriptions. However, one Code and Description block can contain one or more than one codes and descriptions.