I got this following error while running the python program.
"AttributeError: module 'urllib' has no attribute 'request'"
SOURCE CODE: https://stackoverflow.com/questions/43982002/extract-the-src-attribute-from-an-img-tag-using-beautiful-soup
CODE:
from bs4 import BeautifulSoup as BSHTML import urllib page = urllib.request.urlopen('https://github.com/abushoeb/emotag') soup = BSHTML(page) images = soup.findAll('img') for image in images: # Print image source print(image['src']) # Print alternate text print(image['alt'])
UPDATED CODE:
import urllib.request
VIDEO GUIDE:
Post your comments / questions
Recent Article
- Fix-Gradient effect turning to gray in after effects
- How to blur an image in python?
- ModuleNotFoundError: No module named 'whois' in Python GoviralHost Without Terminal
- How to Convert Image to Pencil Sketch in Python?
- How to Extract audio from video files using python?
- PermissionError: [Errno 13] Permission denied: 'shampoo_sales.csv' - Python
- [WinError 145] The directory is not empty: 'FolderPath' - Python
- How to generate barcode using python?
Related Article