counterX=0
for i in range(len(n)):
#print (n[i])
if type(n[i]) is list:
x.append(n[i])
counterX+=1
#print (x)
elif type(n[i]) is int:
x[counterX-1].append(n[i])
# print (x)
n= [['a','b','c'],1,2,4,5,['x','z','w'],6,7,['d','e','f'],8,9,10]
x = []
for i in range(len(n)):
if type(n[i]) is list:
x.append(n[i])
mark = len(x) - 1
elif type(n[i]) is int:
x[mark].append(i)
x
Out[234]:
[['a', 'b', 'c', 1, 2, 3, 4],
['x', 'z', 'w', 6, 7],
['d', 'e', 'f', 9, 10, 11]]
wb = load_workbook('table.xlsx')
ws=wb['data']
row2=ws[2]
for cell in row2:
print (cell.value, end="")
подробнее в документации смотри
https://openpyxl.readthedocs.io/en/stable/tutorial.html
df['B2']=[re.sub('[^.]','', str(x)) for x in df['B'].fillna(0) ]
dict_Apteka = {
'Lekartsva ot Nasmorka':('Nazivin','Ksimelin', 'Nazolneks','Pinosol','Nazol') ,
'Lekartsva it Golovnoy Boli':('Spazmolgon','Ibuprofen','Nurofen'),
'Lekartsva ot Diarei':('Neosmektin','Smekta','Dioktab'),
'Lekartsva ot Otravleniya':('Sorbeks','Atoksil','Enterosgel'),
'Lekarstva ot Kahlya':('Bromgeksin','Lazolvan','Bronxolitin'),
'Lekarstva ot Temperaturi':('Rinza','Aspirin','Ibuklin'),
'Lekarstva ot Grippa':('Teraflu',)' # Создали Словарь "Аптека"
}
dict_Apteka = [
{'Lekartsva ot Nasmorka':('Nazivin','Ksimelin', 'Nazolneks','Pinosol','Nazol') },
{'Lekartsva it Golovnoy Boli':('Spazmolgon','Ibuprofen','Nurofen')},
{'Lekartsva ot Diarei':('Neosmektin','Smekta','Dioktab')},
{'Lekartsva ot Otravleniya':('Sorbeks','Atoksil','Enterosgel')},
{'Lekarstva ot Kahlya':('Bromgeksin','Lazolvan','Bronxolitin')},
{'Lekarstva ot Temperaturi':('Rinza','Aspirin','Ibuklin')},
{'Lekarstva ot Grippa':('Teraflu',)} # Создали Словарь "Аптека"
]
'stroka'.__dir__()
n= [['a','b','c'],1,2,['d','e','f'],3,4]
m=[]
for i in range (0, len(n), 3):
m+=[n[i]+[n[i+1]]+[n[i+2]]]
list_data[номер индекса]