When opening a file and concatenating the 5th character from each string, I'm getting duplicates of each character in the new string. How can I fix this?
def fifthchar(filename):
l=""
fin=open(filename, "r")
for line in fin:
line=line.strip()
line=str(line)
for i in line:
if len(line)>=5:
a=line[4]
l+=a
fin.close()
return l