How to remove this semicolon(;) from a text file. content of my text file:
201911007,1,28;
201203008,1,28;
199710014,1,28;
201612010,1,28;
201710017,1,28;
Then python reads it it always have semicolon at the end of 28 if I run the codes
with open("empMR.txt", 'r') as files:
for dln in files:
dln = dln.strip()
if len(dln) >= 1:
lii = dln.split(",")
MR_empno.append(lii[0].strip())
month.append(lii[1].strip())
days_work.append(lii[2].strip())
print(days_work)
OUTPUT: ['28;', '28;', '28;', '28;', '28;'] I want to remove the semicolon(;) on each output Expected output[28, 28, 28, 28, 28]
If you want to remove the ; permanently from your file. Open the file with vim
If you want to handle it in python