Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python

How do you use urllib in Python 3?

I'm trying a coding challenge but my importing of urllib is giving me tracebacks. I've tried "import urllib.reques" and "importurllib.parse"

Currently searching on the interwebs to see how to figure it out so if anyone knows, feel free to point me in the right direction. Thank you!

Hmm... How are you wanting to use it?

I usually just use import requests when trying to scrape by url.

Check out this stack overflow page.

https://stackoverflow.com/questions/2792650/python3-error-import-error-no-module-name-urllib2#2792652

1 Answer

Hi Todd, Appreciate the response and link, helped quite a bit. I was able to test some of the code from stack, run through it and read it. It provided understanding as to why my original syntax didn't work and ways to improve.

I attempted a web scraping tutorial, and kept getting errors on the import. Found out the tutorial was in Python 2 which made it tricky because I just started learning python. Many thanks Todd, cheers!