0

I wrote the following code:

produk = soup.find_all("div","col-lg-3 col-md-4 col-sm-6 bt-product-list")
i = 1
for p in produk:
    print p.find('div','bt-product-list-info').get_text()
    print p.find('div','col-md-3 col-xs-12 bt-product-list-price')

This returns the following error:

File "<ipython-input-3-1db13187c15e>", line 4
    print p.find('div','bt-product-list-info').get_text()
          ^
SyntaxError: invalid syntax
2
  • which python you are using? Commented Oct 30, 2019 at 8:51
  • @Yogi Dwinanto if you're using python3, use print(p.find(...)) instead of print p.find(...). Commented Oct 30, 2019 at 8:52

1 Answer 1

1

You are most likely using Python 3, in which print is a function rather than a statement. You would need to modify your code to look like this:

produk = soup.find_all("div","col-lg-3 col-md-4 col-sm-6 bt-product-list")
i = 1
for p in produk:
    print(p.find('div','bt-product-list-info').get_text())
    print(p.find('div','col-md-3 col-xs-12 bt-product-list-price'))
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.