glob を使ってフォルダ内にある画像を読み込みたいのですが、type error が出てしまいます。
import glob
file = glob.glob("D:/py/card/*")
print(file)
将来的には、参照したフォルダ内の画像をランダムに取り出すプログラムを、下記のプログラムを土台にして作成したいです。
def pick():
nums = sample((0,120),6) label1.configure(text = nums[0]) label2.configure(text = nums[1]) label3.configure(text = nums[2]) label4.configure(text = nums[3]) label5.configure(text = nums[4]) label6.configure(text = nums[5]) getBtn.configure(state=NORMAL) resBtn.configure(state=NORMAL)
発生している問題・エラーメッセージ
エラーメッセージ
Traceback (most recent call last):
File "d:\py\glob.py", line 1, in <module>
import glob
File "d:\py\glob.py", line 3, in <module>
file = glob.glob("D:/py/card/*")
TypeError: 'module' object is not callable
ソースコード
いろいろなサイトを調べたのですが、欲しい情報が見つからず質問しました。
初めての質問ですが、よろしくお願いします。
回答2件
あなたの回答
tips
プレビュー