I'm trying to write a code that makes the first letter of every line in uppercase, but it is unable to execute past the 6th line if l[0].islower(): . The l[0] works fine when it's outside the loop, but is always says "String Index out of range" when I put it back in the loop.
m = open(r"C:\Users\■■■■■■\Desktop\■■■■\other.txt","r", encoding = "utf-8") #Just blocking the text out
while True:
l = m.readline()
if l[0].islower():
l.replace(l[0],l[0].upper())
print(l)
if not l:
break
m.close()
for line in m? Anyway you should put theif not lright after readingl, not in the endreplace(l[0], ...)will replace all occurrences of that letter, not just the first