Python Forum
Who can help the SyntaxError: expected ':' for forloop
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Who can help the SyntaxError: expected ':' for forloop
#1
Smile 
from bs4 import BeautifulSoup
html="""
<html>
<head>
<meta charset="utf-8"/8>
<title>Hello</title>
</head>
<body>
<p>Hellow World1</p>
<p>Hellow World2</p>
<p>Hellow World3</p>
</body>
</html>
"""
sp=BeautifulSoup(html,"html.parser")
list1=sp.find_all("p")
print(list1)
print(len(list1))
for i in range(1,len(list1))
print(list1[i])
#for i in range(len(list1))
# print(list1[i].text)

what wrong of this python program?
The python show below error:
File "C:\Users\user\Documents\Beautifulsoup sample.py", line 19
for i in range(1,len(list1))
^
SyntaxError: expected ':'
Reply


Messages In This Thread
Who can help the SyntaxError: expected ':' for forloop - by skchui6159 - Aug-22-2024, 02:10 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020