import pandas as pd
tbl=pd.read_excel("Книга2.xlsx",index_col=0,header=0,dtype={'A': str})
cr=True
list_inn = ["1","3","4"]
for listt in list_inn:
if cr==True:
print(tbl.loc[int(listt)].B)
if tbl.loc[int(listt)].B=='char':
cr=False
else:
print(tbl.loc[int(listt)].C)
some text
char
S
import itertools
x = [1, 2, 3]
y = [10, 20, 30]
z = [100, 200, 300]
ar=np.array(list(itertools.product(x,y,z))).reshape(len(x),len(y),len(z),-1)
array([[[[ 1, 10, 100],
[ 1, 10, 200],
[ 1, 10, 300]],
[[ 1, 20, 100],
[ 1, 20, 200],
[ 1, 20, 300]],
[[ 1, 30, 100],
[ 1, 30, 200],
[ 1, 30, 300]]],
[[[ 2, 10, 100],
[ 2, 10, 200],
[ 2, 10, 300]],
[[ 2, 20, 100],
[ 2, 20, 200],
[ 2, 20, 300]],
[[ 2, 30, 100],
[ 2, 30, 200],
[ 2, 30, 300]]],
[[[ 3, 10, 100],
[ 3, 10, 200],
[ 3, 10, 300]],
[[ 3, 20, 100],
[ 3, 20, 200],
[ 3, 20, 300]],
[[ 3, 30, 100],
[ 3, 30, 200],
[ 3, 30, 300]]]])
ar.shape
(3, 3, 3, 3)
flag=False
dt=datetime.date(2022,1,1)
while dt<datetime.date(2023,1,1):
if flag==True:
color='Черная'
else:
color='Белая'
print(dt,color)
flag= not flag
dt+=datetime.timedelta(days=1)
...
2022-02-25 Черная
2022-02-26 Белая
2022-02-27 Черная
2022-02-28 Белая
2022-03-01 Черная
2022-03-02 Белая
2022-03-03 Черная
...
2022-03-29 Черная
2022-03-30 Белая
2022-03-31 Черная
2022-04-01 Белая
2022-04-02 Черная
....
file_name, pattern = Gen()
print(file_name, pattern)
Gen()
print(file_name, pattern)