Leela-Consultancy / PPDM_Dev_Prototype_Odoo

1 stars 3 forks source link

Python Code #12

Open Ashwin-Leela opened 1 year ago

Ashwin-Leela commented 1 year ago

from difflib import diff_bytes from operator import le import pandas as pd import csv

Read excel file with sheet name

input_list = pd.read_excel('File for Python.xlsx', sheet_name=['Input'], usecols='A') keyword_list = pd.read_excel('File for Python.xlsx', sheet_name=['Checklist'], usecols='C') checklist_list = pd.read_excel('File for Python.xlsx', sheet_name=['Checklist'], usecols='B')

key=keyword_list['Checklist'].values.tolist() checkk=checklist_list['Checklist'].values.tolist() inputt=input_list['Input'].values.tolist()

f = open('demo.csv', 'w') writer = csv.writer(f) header= ['File Name', 'Check List'] writer.writerow(header)

for i in range(0, len(inputt)): tim=0 flag=0 strr=inputt[i][0] for k in range(1, len(key)): if (k == 17): continue chec=key[k][0] if (k == 19): chec=chec[:-1] if (',' in chec): chec_list=chec.split(', ') for j in range(0,len(chec_list)): if(strr.find(chec_list[j]) == 0): tim=k flag=1 break if(strr.find(chec) != -1): tim=k flag=1 break if (flag == 1): break

if( flag == 1 ):
    heat=[strr,checkk[tim][0]]
    writer.writerow(heat)
else:
    heat=[strr]
    writer.writerow(heat)
flag=0