Apr-22-2020, 08:45 AM
Hello everyone,
when i try to compare list first element i am getting a syntax error. "if satırsayısı2=isimsatırlistesi[0]" this list is made of " isimsatırlistesi.append(int(satırsayısı))" so all the elements of the list are int not sure how to avoid this. Any suggestions ?
when i try to compare list first element i am getting a syntax error. "if satırsayısı2=isimsatırlistesi[0]" this list is made of " isimsatırlistesi.append(int(satırsayısı))" so all the elements of the list are int not sure how to avoid this. Any suggestions ?
fhand=open("arb1.txt") satırsayısı=0 isimsatırlistesi=list() for line in fhand: satırsayısı=satırsayısı+1 if line.startswith("Adres"): isimsatırlistesi.append(int(satırsayısı)) adressatırı=list() satırsayısı2=0 satırdakikelimesayısı=0 for line in fhand: satırsayısı2=satırsayısı+1 if satırsayısı2=isimsatırlistesi[0] # getting the error here print(line)