Python TypeError: 'module' object is not callable 原因分析
今天尝试使用pprint进行输出,语句为
>>>import pprint
>>>pprint(people)
结果报错,TypeError: 'module' object is not callable
{
bob = [['name','bob smith'],['age',42],['pay',30000],['job','software']]
sue = [['name','sue jones'],['age',42],['pay',40000],['job','hardware']]
people = [bob,sue]
}
原因分析:
Python导入模块的方法有两种:
import module 和 from module import
区别是前者所有导入的东西使用时需加上模块名的限定,而后者则不需要
例:
>>>import pprint
>>>pprint(people)
OR
>>>from pprint import *
>>>pprint(people)
Python TypeError: 'module' object is not callable 原因分析的更多相关文章
- python 报错——Python TypeError: 'module' object is not callable 原因分析
原因分析:Python导入模块的方法有两种: import module 和 from module import 区别是前者所有导入的东西使用时需加上模块名的限定,而后者则不需要 例: >&g ...
- TypeError: 'module' object is not callable 原因分析
程序代码 class Person: #constructor def __init__(self,name,sex): self.Name = name self.Sex = sex def ToS ...
- python -- TypeError: 'module' object is not callable
文件: 代码: import pprintmessge = 'It was a bringht cold day in April,and the clocks were striking thrir ...
- TypeError: 'module' object is not callable cp fromhttp://blog.csdn.net/huang9012/article/details/17417133
程序代码 class Person: #constructor def __init__(self,name,sex): self.Name = name ...
- python import 错误 TypeError: 'module' object is not callable
python import 错误 TypeError: 'module' object is not callable 在这里,有 Person.py test.py; 在 test.py 里面 im ...
- PyCharm+selenium环境搭建报错:Traceback (most recent call last): TypeError: 'module' object is not callable
环境搭建好后,代码如下: from selenium import webdriverdriver = webdriver.chrome()driver.get("http://www.ba ...
- Python: TypeError: 'dict' object is not callable
问题: TypeError: 'dict' object is not callable 原因: dict()是python的一个内建函数,如果将dict自定义为一个python字典,在之后想调用 ...
- pip安装pillow——死循环:[WinError5] & [TypeError:'module' object is not callable]
1.这次本来要安装个pillow,记得以前装了的,怎么这次就不行了.然后,下意识的使用:pip3 install pillow. 发现报错: [TypeError:'module' object is ...
- pip install 报错 TypeError: 'module' object is not callable
$ pip install filetype Traceback (most recent call last): File "/usr/local/bin/pip2", line ...
随机推荐
- Linux 进程同步和通信
为了同步进程所以需要进程通信 管道(有名:文件形式存在,无名:仅限于父子进程间通信) 消息队列 信号量 共享存储 套接字(可用于不同机器)
- springmvc 跳转页面或者返回json
方法的返回使用ModelAndView,分别new两个modelAndView,返回json的 是ModelAndView mv = new ModelAndView(new MappingJacks ...
- 20175314 《Java程序设计》第八周学习总结
20175314 <Java程序设计>第八周学习总结 教材学习内容总结 安利一个非常实用的图片处理工具:图片工厂,它具有非常强大的图片批处理能力,比如加水印.降低画质.命名等,不仅如此它还 ...
- Git简单生成生成公钥和私钥方法
Git简单生成生成公钥和私钥方法 Git配置 Git安装完之后,需做最后一步配置.打开git bash,分别执行以下两句命令 git config --global user.name “用户名” g ...
- Maven解决NoPluginFoundForPrefixException错误
Maven解决NoPluginFoundForPrefixException错误方法 错误出现的原因 你指的是一个不存在的插件,如由于错误的前缀. 您使用的是第三方的Maven插件没有部署到中央Mav ...
- Spring常用注解总结(3)
@Configuration 表示该类为"配置类",可替换xml配置文件.与@Component不同的是,@Configuration会生成CGLIB代理class. @Targe ...
- 解决overflow: hidden在移动端失效问题
1.问题:移动端出现弹窗后,滑动页面,页面底部出现空白 二.原因 经过分析,发现overflow: hidden;在移动端失效,导致弹窗出现时,滑动页面,页面底部出现空白. 三.解决 参考网址:htt ...
- windows server 2016安装
slmgr /skms kms.03k.org slmgr /ato slmgr /ipk WC2BQ-8NRM3-FDDYY-2BFGV-KHKQY kms服务器: https://03k.org/ ...
- github node.js
#安装githubyum install git -y #下载nvmgit clone git://github.com/creationix/nvm.git ~/nvm #设置nvm 自动运行;ec ...
- 在Jenkins上配置批处理删除远程共享目录7天以上的文件
net use * /del /yes NET USE X: \\10.29.48.12\shares\Test password /user:DOMAIN1\account set AutoPath ...