I have a txt with some information. The txt follows the following pattern:
1 - Starting block
2 - Information
3 - Description of line 2
So, for example
190845 3890580235203895 0329045832854880328 58908349058340534859 hjdfhgjdfhg dgfdgdf
22343 34234234 324234 324234234 234234 342324989856475959596
3SHDSHFUHDSFUHSDUFHSHDFUDSFDSTTJKKHGHJMNMNBN
22343 34234234 324234 324234234 234234 342324989856475959596
3SHDSHFUHDSFUHSDUFHSHDFUDSFDSTTJKKHGHJMNMNBN
22343 34234234 324234 324234234 234234 342324989856475959596
3SHDSHFUHDSFUHSDUFHSHDFUDSFDSTTJKKHGHJMNMNBN
120845 3890580235203895 0329045832854880328 58908349058340534859 hjdfhgjdfhg dgfdgdf
22343 34234234 324234 324234234 234234 342324989856475959596
3SHDSHFUHDSFUHSDUFHSHDFUDSFDSTTJKKHGHJMNMNBN
What I need is to separate the different blocks into different variables knowing that they start at 1 and end at the next incidence of 1. The example above would look like this:
a = '190845 3890580235203895 0329045832854880328 58908349058340534859 hjdfhgjdfhg dgfdgdf
22343 34234234 324234 324234234 234234 342324989856475959596
3SHDSHFUHDSFUHSDUFHSHDFUDSFDSTTJKKHGHJMNMNBN
22343 34234234 324234 324234234 234234 342324989856475959596
3SHDSHFUHDSFUHSDUFHSHDFUDSFDSTTJKKHGHJMNMNBN
22343 34234234 324234 324234234 234234 342324989856475959596
3SHDSHFUHDSFUHSDUFHSHDFUDSFDSTTJKKHGHJMNMNBN'
b = '120845 3890580235203895 0329045832854880328 58908349058340534859 hjdfhgjdfhg dgfdgdf
22343 34234234 324234 324234234 234234 342324989856475959596
3SHDSHFUHDSFUHSDUFHSHDFUDSFDSTTJKKHGHJMNMNBN'
I've tried combining while
+ readline
+ startswith
, but I could not