I don't know why it giving me ...un valid syntax in line 8 (file . close ),can any one tell why ,or give a clue what it be | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I don't know why it giving me ...un valid syntax in line 8 (file . close ),can any one tell why ,or give a clue what it be

lines=file.readlines() for i in lines: lines = i.replace("\n","") print (lines[0] +str(len(lines)) file.close()

26th Mar 2022, 2:03 PM
Musab Adam
Musab Adam - avatar
2 Answers
+ 2
What is 'file' there? Pls share full code. edit: Musab Adam between you are missing a closing brace ) in print statement
26th Mar 2022, 2:10 PM
Jayakrishna 🇮🇳
+ 1
Thank you for your help ...it turned out that I mess closing brace ") " ...
27th Mar 2022, 7:09 AM
Musab Adam
Musab Adam - avatar