Skip to main content
Code Review

Return to Answer

Commonmark migration
Source Link

###Imports

Imports

###Constants

Constants

###Functions

Functions

###All the code

All the code

###Imports

###Constants

###Functions

###All the code

Imports

Constants

Functions

All the code

replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

If you don't know what's with if __name__ == '__main__' you can read more about it here here

If you don't know what's with if __name__ == '__main__' you can read more about it here

If you don't know what's with if __name__ == '__main__' you can read more about it here

added 244 characters in body
Source Link
Grajdeanu Alex
  • 9.3k
  • 4
  • 32
  • 71
def download_images(soup):
 """Docstring here."""
 for link in soup.findAllfind_all('img'):
 image_url = link.get('src')
 if validate(image_url):
 image = requests.get(image_url)
 if image.status_code == 200:
 with open(image_name(), 'wb') as f:
 f.write(image.content)

If you don't know what's with if __name__ == '__main__' you can read more about it here

More, note that all the functions have a docstring which contain a placeholder like "Docstring here.". You can replace that placeholder with a summary that describes what each function does.

def download_images(soup):
 """Docstring here."""
 for link in soup.findAll('img'):
 image_url = link.get('src')
 if validate(image_url):
 image = requests.get(image_url)
 if image.status_code == 200:
 with open(image_name(), 'wb') as f:
 f.write(image.content)

If you don't know what's with if __name__ == '__main__' you can read more about it here

def download_images(soup):
 """Docstring here."""
 for link in soup.find_all('img'):
 image_url = link.get('src')
 if validate(image_url):
 image = requests.get(image_url)
 if image.status_code == 200:
 with open(image_name(), 'wb') as f:
 f.write(image.content)

If you don't know what's with if __name__ == '__main__' you can read more about it here

More, note that all the functions have a docstring which contain a placeholder like "Docstring here.". You can replace that placeholder with a summary that describes what each function does.

added 114 characters in body
Source Link
Grajdeanu Alex
  • 9.3k
  • 4
  • 32
  • 71
Loading
added 4 characters in body
Source Link
Grajdeanu Alex
  • 9.3k
  • 4
  • 32
  • 71
Loading
Source Link
Grajdeanu Alex
  • 9.3k
  • 4
  • 32
  • 71
Loading
lang-py

AltStyle によって変換されたページ (->オリジナル) /