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 ...
随机推荐
- jupyter notebook 代码自动补齐插件
安装: . pip install jupyter_contrib_nbextensions -i https://pypi.mirrors.ustc.edu.cn/simple 2. jupyter ...
- Java基础(命令行操作、注释及API、)
一.常用的dos命令. dir:列出当前目录下的文件及文件夹 md:创建目录 rd:删除目录 cd:进入到指定目录 cd..:退出到上一级目录 cd\:退出到根目录 del:删除文件 exit:退出d ...
- gym 101982 B题 Coprime Integers
题目链接:https://codeforces.com/gym/101982/attachments 贴一张图吧: 题目意思就是给出四个数字,a,b,c,d,分别代表两个区间[a,b],[c,d],从 ...
- 阅读:JAVA 3& 4
随机数: Random rand = new Random(47); // 产生随机算子.47 is seed. for incovating predicatable random numberin ...
- canvas的使用方法
了解canvas:canvas标签是用作图形绘制,但是通过js脚本来实现的,canvas标签其实只是一个容器 ,最终实现绘制功能肯定是通过js脚本实现. 首先肯定要定义一个canvas标签当做容器 & ...
- js二分算法排序
var arr = [1,2,3,5,10,15,23,35,67,76,78,89,100];var len = arr.length;for (var i = 1; i < len; i++ ...
- mysql 数据库导入导出方法总结
一般形式:mysqldump -h IP -u 用户名 -p 数据库名 > 导出的文件名 (1)-p 后面不能加password,只能单独输入如1中那样 (2)mysqldump是在cmd下的命 ...
- 服务管理之httpd
目录 1. httpd简介 2. httpd版本 2.2 httpd-2.4新增的模块 3. httpd基础 3.1 httpd自带的工具程序 3.2 rpm包安装的httpd程序环境 3.3 web ...
- WebDriver中的操作使用
1.WebDriver中使用jquery假如设定jquery包的路径为path,则程序如下: String jquery=null; FileInputStream input = new FileI ...
- cobbler自动装机服务简介与配置
cobbler简介 Cobbler是一个Linux服务器安装的服务,可以通过网络启动(PXE)的方式来快速安装.重装物理服务器和虚拟机,同时还可以管理DHCP,DNS等. Cobbler可以使用命令行 ...