我想用urlparse.但是python3.4.1没有找到模块.
我这样做import urlparse,但它给了我这个错误
importError: no 'module' named ulrparse
Run Code Online (Sandbox Code Playgroud) 我想导入urllib以使用函数'request'.但是,我在尝试这样做时遇到了错误.我试过pip install urllib,但仍然有同样的错误.我使用的是Python 3.6.真的很感激任何帮助.
我使用以下代码导入urllib.request:
import urllib.request, urllib.parse, urllib.error
fhand = urllib.request.urlopen('data.pr4e.org/romeo.txt')
counts = dict()
for line in fhand:
words = line.decode().split()
for word in words:
counts[word] = counts.get(word, 0) + 1
print(counts)
Run Code Online (Sandbox Code Playgroud)
但它给了我这个错误:ModuleNotFoundError:没有名为'urllib.parse'的模块; 'urllib'不是一个包