作者a82 (QQ)
看板Python
標題[問題] 關於模組
時間Sat Dec 24 13:42:20 2016
書上寫requests是一個模組
我用python shell 打上requests 也顯示是module
它顯示到最後是一個__int__.py 而不是requests.py
<module 'requests' from
'C:\.......\\Python35\\lib\\requests\\__init__.py'>
我的認知是模組是一個py檔 目前我會的是這樣
所以我也看不懂requests.get() 那get()到底在哪
我認為get()應該在在一個requests.py 檔內
我是哪裡弄錯了呢?
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.198.185.78
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1482558143.A.D26.html
推 tiefblau: 小模組 12/24 15:25
→ kenduest: 都有 source code, 你打開 __init__.py 看看就知道了 12/24 17:59
→ a82: 我打開了 但不懂什麼意思 我也找不到get阿 12/24 18:34
→ kenduest: 裡面不是有一行 get 的 import 敘述 ? 12/24 20:35
→ kenduest: from .api import request, get, head, post, patch 12/24 20:36
→ kenduest: 所以你才可以用 requests.get(), requests.post() 這類 12/24 20:37
→ kenduest: get() 這類 function 在 api.py 檔案內 12/24 20:37
→ a82: 感謝你 12/25 00:34