Python TypeError: 'module' object is not callable错误

        在进行python词处理调试的时候出现这个问题TypeError: 'module' object is not callable,本来以为是caption不能迭代,后来打印出captions 打印出captions是一个列表显然是可以迭代的,tqdm的问题?

Python TypeError: 'module' object is not callable错误_第1张图片

下图查找tqdm模块命令得到:

Python TypeError: 'module' object is not callable错误_第2张图片

 

通过博客https://blog.csdn.net/flhsxyz/article/details/79207180的介绍以及help(tqdm)的用法可知,tqdm为一个类并不仅仅只是一个模块,因此正确用法如下所示:

import tqdm  #错误用法
from tqdm import tqdm #正确用法

之前发生Type error的错误是因为笔者采用了错误的tqdm的导入方式所致。。

你可能感兴趣的:(编程语言,python)