|
|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
➜ desktop ccat pp.py
import requests
def download(url):
r = requests.get(url)
with open("res.txt", 'w', encoding='utf-8') as f:
f.write(r.text)
def main():
url = input("Enter your url here... ")
download(url)
if __name__ == '__main__':
main()
================================
➜ desktop ./pp.py
./pp.py: line 1: import: command not found
./pp.py: line 3: syntax error near unexpected token `('
./pp.py: line 3: `def download(url):'
➜ desktop python3 pp.py
Traceback (most recent call last):
File "pp.py", line 1, in <module>
import requests
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/requests/__init__.py", line 43, in <module>
import urllib3
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/urllib3/__init__.py", line 8, in <module>
from .connectionpool import (
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/urllib3/connectionpool.py", line 58, in <module>
class ConnectionPool(object):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/urllib3/connectionpool.py", line 65, in ConnectionPool
QueueCls = queue.LifoQueue
AttributeError: module 'queue' has no attribute 'LifoQueue'
=====================================
为什么会有这样的问题? |
|