-1

I am trying to figure out a way to break a long for loop to make it PEP-8 valid. (I'm using flake8 vscode extension).

This is the code:

for result_row in soup.find_all('div', {"class": "b2c-inner-data-wrapper"}):
    ..............

The error I get is:

line too long (88 > 79 characters)

I've tried:

for result_row in soup.find_all('div',
{"class": "b2c-inner-data-wrapper"}):

But I get:

continuation line under-indented for visual indent

What is the right way of doing it? Thanks.

  • Can not reproduce. That line is only 76 characters. – wim Nov 23 '22 at 19:29
  • if you install black and run it on your file, it will reformat to match the pep-8 linting rules. or if not, i would indent the contents of findall's parentheses on a newline – ekrall Nov 23 '22 at 19:47

1 Answers1

2
result_rows = soup.find_all('div', {"class": "b2c-inner-data-wrapper"})
for result_row in result_rows:
    ..............
Cargo23
  • 3,064
  • 16
  • 25