今天尝试使用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 原因分析的更多相关文章

  1. python 报错——Python TypeError: 'module' object is not callable 原因分析

    原因分析:Python导入模块的方法有两种: import module 和 from module import 区别是前者所有导入的东西使用时需加上模块名的限定,而后者则不需要 例: >&g ...

  2. TypeError: 'module' object is not callable 原因分析

    程序代码 class Person: #constructor def __init__(self,name,sex): self.Name = name self.Sex = sex def ToS ...

  3. python -- TypeError: 'module' object is not callable

    文件: 代码: import pprintmessge = 'It was a bringht cold day in April,and the clocks were striking thrir ...

  4. 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   ...

  5. python import 错误 TypeError: 'module' object is not callable

    python import 错误 TypeError: 'module' object is not callable 在这里,有 Person.py test.py; 在 test.py 里面 im ...

  6. PyCharm+selenium环境搭建报错:Traceback (most recent call last): TypeError: 'module' object is not callable

    环境搭建好后,代码如下: from selenium import webdriverdriver = webdriver.chrome()driver.get("http://www.ba ...

  7. Python: TypeError: 'dict' object is not callable

    问题:  TypeError: 'dict' object is not callable 原因:  dict()是python的一个内建函数,如果将dict自定义为一个python字典,在之后想调用 ...

  8. pip安装pillow——死循环:[WinError5] & [TypeError:'module' object is not callable]

    1.这次本来要安装个pillow,记得以前装了的,怎么这次就不行了.然后,下意识的使用:pip3 install pillow. 发现报错: [TypeError:'module' object is ...

  9. pip install 报错 TypeError: 'module' object is not callable

    $ pip install filetype Traceback (most recent call last): File "/usr/local/bin/pip2", line ...

随机推荐

  1. del_cursor 批量删除游标

    declare   cursor [del_cursor] is select a.*, a.rowid row_id from [table_name] a order by a.rowid;   ...

  2. 通过.ibd和.frm恢复mysql数据

    背景:因为机器损坏,数据库的索引文件什么的都损坏了.只留下了一个mysql的data目录… 此方法恢复数据的前提:建表用的innodb索引   备注:如果mysql的目录还都在,可以先尝试,将mysq ...

  3. Java相关查询记录

    Version of Spring Facet could not be detected. http://yijiesuifeng.iteye.com/blog/2221444

  4. 移动端rem适配

    (function(_D) { var _self = {}; _self.resizeEvt = 'orientationchange' in window ? 'orientationchange ...

  5. layui数据表格监听按钮问题

    layui官网文档源码 原始容器 <table id="demo" lay-filter="test"></table> 工具栏模板: ...

  6. 天坑!c++调用python,遭遇R6034问题

    起源: AllMyTube下载核心,是c#组件调用c++dll,在dll中初始化Python运行环境.在工作目录有msvcr90.dll文件时,程序运行会弹出如下错误: R6034. -------- ...

  7. 关于jqGrid组件数据显示不出问题

    jqGrid组件一开始怎么数据都返回了渲染不出来,查找了一天,最后发现点击搜索之后doSearch()事件触发的方法并不是数据请求接口,而是再次请求了初次登录的接口,从初次登录返回的数据,数据格式没问 ...

  8. Centos7系统安装部署docker

    一.安装docker #创建docker相关的目录 mkdir -p /data/docker #安装docker运行必要工具 sudo yum install -y yum-utilsdevice- ...

  9. why?

    优点 充分利用多核CPU的计算能力: 方便进行业务拆分,提升应用性能 缺点 上下文切换 注意线程安全,避免死锁

  10. Ruby http/net 中连接超时问题

    下面在调用币安的接口时,经常会卡住,设置连接超时也不会抛出异常,代码如下(默认连接超时为nil, 参考:https://github.com/ruby/ruby/pull/269): require ...