Make WPPF Sheet My comany 2nd Project and My 3rd
l=[file for file in os.listdir() if '.txt' in file]
l
['example.txt', 'LICENSE.txt', 'NEWS.txt', 'saeed.txt', 'temp.txt']
# First make SET of Employes code from all file
d={'21109':['JAN-2022',1,29],'21111':[3,30]}
d['21109']
['JAN-2022', 1, 29]
dd={'21109':[[1,2022,1,29],[2,2002,3,26]]}
dd={mcode:[[month,year,prv,present],][month,year,prv,present]}
allmonths=[mdate,mdate,mdate,mdate]
mdate=(1,month,year)
allmonths.sort()
Format of txt file is as under delimited with TAB \t
import datetime
mdate=datetime.datetime(2023,6,13)
mdate1=datetime.datetime(2023,1,13)
mdate3=datetime.datetime(2023,8,13)
type(mdate)
<class 'datetime.datetime'>
l=[mdate,mdate3,mdate1]
l
[datetime.datetime(2023, 6, 13, 0, 0), datetime.datetime(2023, 8, 13, 0, 0), datetime.datetime(2023, 1, 13, 0, 0)]
l.sort()
l
[datetime.datetime(2023, 1, 13, 0, 0), datetime.datetime(2023, 6, 13, 0, 0), datetime.datetime(2023, 8, 13, 0, 0)]
simply made dict as under
{'21109':[(29,1),(28,1),(31,0),(0,0)]}
first item in list is for first month and IInd for iind month and so on....
if an emp not exist in nay month then add (0,0)
-------------------------dwapr-22-------------------------
CODE NAME DAYS PDAYS MONTH YEAR
00010 KARIM BUX 9 0 4 2022
00030 SALEEM 9 0 4 2022
00245 MANZOOR 10 0 4 2022
00301 LIAQUAT ALI 4 0 4 2022
00360 ABDUL LATIF 8 0 4 2022
00361 KHUDA DINO 14 0 4 2022
00374 REHMATULLAH 24 0 4 2022
00439 ALI BUX 23 0 4 2022
00495 MIRCHOO 14 0 4 2022
00503 MUHAMMAD JUMAN 24 0 4 2022
00556 MANZOOR ALI 26 0 4 2022
Comments
Post a Comment