[問題] module跟type的問題
各位版友好
最近在學python時碰到了一些問題
from Image import *
#import Image
img = Image.open("test2_thumb.jpg")
print type(img)
我把import Image註解掉之後,會出現:
AttributeError: class Image has no attribute 'open'
但是我已經from Image import *
請問為什麼還是會出現這樣的錯誤?
第二個問題就是,我想要印出img的type
print type(img)
他出現的是<type 'instance'>
但是為什麼不是出現<type 'Image'>呢?
又<type 'instance'>是什麼樣的意思?
在網路上面找了一些資料都沒辦法解答我的困惑
所以來這邊請教版友
謝謝各位版友的指教
--
~宅男的四個徵兆~
∠□ ○ ! * \○/ ★ (○ ?
╦╦└□ " ○□═ □ □>
║║√√ ╦══╦ ∥ |\
一回家就上PTT 每天想正妹 以當好人為樂 忘記正妹虧欠自己
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 123.241.167.223
※ 編輯: Arim 來自: 123.241.167.223 (05/31 01:43)
推
05/31 01:52, , 1F
05/31 01:52, 1F
→
05/31 01:52, , 2F
05/31 01:52, 2F
推
05/31 03:27, , 3F
05/31 03:27, 3F
→
05/31 03:30, , 4F
05/31 03:30, 4F
→
05/31 03:34, , 5F
05/31 03:34, 5F
Python 近期熱門文章
PTT數位生活區 即時熱門文章