espero esten bien, resulta que tengo la siguiente lista de datos:
list= [ '#Sta/Elev= 300',
'0 2200.8 1.6 2199.63 2.2 2199.24 2.7 2198.82 3.2 2198.35',
'3.7 2197.87 4.7 2196.77 5.3 2196.28 6.3 2195.59 6.8 2195.33',
'7.3 2195.11 7.8 2194.87 8.2 2194.58 8.4 2194.5 8.9 2193.93',
'10.3 2192.15 10.9 2191.4 11.1 2191.25 11.5 2190.89 12.7
'#Mann= 3 , 0 , 0',
'#Sta/Elev= 190',
'0 2193.2 .2 2193.09 .5 2192.89 1.2 2192.38 1.4 2192.23',
'1.6 2192.16 2.1 2191.94 2.6 2191.61 3.4 2190.93 3.9 2190.47',
'4.6 2189.91 5.1 2189.18 5.5 2188.77 5.8 2188.48 6.6 2187.79',
'7 2187.31 7.6 2186.77 8.5 2186.12 8.7 2185.96 9.4 2185.44',
'10.1 2184.83 11 2184.01 12.3 2182.62 13.9 2181 14.8 2180.12',
'15.7 2179.25 15.9 2179.14 16.2 2178.82 16.9 2178.3 16.9 2178.25',
'17 2178.22 17.3 2177.98 17.3 2177.97 17.7 2177.7 18 2177.41',
'18.7 2176.76 20.9 2174.76 21.1 2174.58 23.6 2172.4 24.5 2171.7',
'24.8 2171.45 252171.337 25.1 2171.28 25.2 2171.24 25.3 2171.19',
'25.5 2171.12 25.9 2171.06 26.2 2171.03 26.9 2171.02 29.4 2171.1',
'33.7 2171.14 33.9 2171.15 34.1 2171.16 34.2 2171.16 34.4 2171.19',
'34.8 2171.24 34.8 2171.26 35.1 2171.33 35.4 2171.43 35.5 2171.44',
'35.5 2171.45 36.3 2171.75 37.5 2172.2 37.6 2172.25 37.7 2172.29',
'38.2 2172.47 38.3 2172.53 38.5 2172.6 38.7 2172.68 38.8 2172.74',
'39 2172.82 39.4 2172.95 39.5 2172.99 39.7 2173.07
'#Mann= 3 , 0 , 0',]
Todos en formato string, mi deseo es hacer un array que contenga arrays especificando la list; es decir quiero un resultado final así:
list2=[[ '#Sta/Elev= 300',
'0 2200.8 1.6 2199.63 2.2 2199.24 2.7 2198.82 3.2 2198.35',
'3.7 2197.87 4.7 2196.77 5.3 2196.28 6.3 2195.59 6.8 2195.33',
'7.3 2195.11 7.8 2194.87 8.2 2194.58 8.4 2194.5 8.9 2193.93',
'10.3 2192.15 10.9 2191.4 11.1 2191.25 11.5 2190.89 12.7 2189.69',
'13.5 2189.04 14 2188.58 14.8 2188.01 15.6 2187.45 15.6 2187.44',
'15.7 2187.41 16 2187.17 16.1 2187.11 17.7 2186.14 19.2 2185.1',
'19.6 2184.93 19.7 2184.9 19.7 2184.89 19.8 2184.88 20.1 2184.79',
'20.2 2184.75 20.5 2184.66, #Mann= 3 , 0 , 0'],[repetir secuencia anterior]]
Esto he intentado pero me arroja error, agradezco su ayuda:
start_patt = ("#Sta/Elev=")
end_patt = ("#Mann")
for k in range(0,len(linelist)):
r= start_patt in linelist[k]
if r== True:
print(yield linelist[k])
s= end_patt in linelist[k]
if s== True:
print(linelist[k])