1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
| import xlwings as xw
import time
import os
def tempsReserv(res):
print("res",res)
arrTemps = res.split(';')
# cumuldelta=
for temps in arrTemps:
if temps.startswith("02")==True:
delta = "OSR"
elif temps.startswith("20")==True:
delta = "OSR"
elif temps.startswith("RP")==True:
delta ="RP"
elif temps.startswith("ADF")==True:
delta ="ADF"
elif temps.startswith("R")==True:
delta ="ING"
elif temps.startswith("V")==True:
delta ="ING"
elif temps.startswith("OSR")==True:
delta ="OSR"
else:
delta ="autre"
return delta
root = '/Users/II1154/Downloads/BT_2022-020522/'
i=1
wb_from = xw.Book(r"C:\Users\II1154\Desktop\bt_sortie_simplifie.xlsx")
ws_from = wb_from.sheets['BT2']
wb_from.sheets['BT2'].select
nb_row = wb_from.sheets['BT2'].range('A1').end('down').row # dernière ligne
datain = wb_from.sheets['BT2'].range('J2:J' + str(nb_row)).value
list_N_aff = []
tpslist = []
h=1
for x in datain:
if x is None:
x=""
print("x",x)
tps = tempsReserv(x)
print("tps",tps)
time.sleep(0)
print("avant_tps_tps",tps)
time.sleep(0)
if h==10000:
print("hhhhhhhhhhhhhhhhhhh",h)
time.sleep(10)
h=h+1
print(h)
list_N_aff.append(tps)
print(list_N_aff)
time.sleep(0) |