今天尝试使用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. PS 知识整理

    Ctrl+J键复制背景图层. ps怎样只让截取的一部分图旋转 https://jingyan.baidu.com/article/d45ad14877fc6e69542b8079.html 按Ctrl ...

  2. nginx+ flume

    nginx 作用: 做负载均衡  nginx和lvs的区别:nginx可以做反向代理 1.上传nginx安装包  tar -zxvf tengine-2.1.02.安装环境  依赖 gcc opens ...

  3. 浏览器登录EBS系统遇到问题总结

    1.可以登录EBS系统,但是职责位置为空白 这是兼容性视图问题,将ERP域名加入兼容性视图列表即可. 加入即可: 2.可以登录EBS系统,但是职责位置显示 “undefined” 这也是兼容性视图问题 ...

  4. 【LOG4J】ログ出力の設定方法

    参考URL: https://blog.csdn.net/zhengtaoit66/article/details/79551945 https://www.cnblogs.com/lujiango/ ...

  5. Python设计模式 - UML - 交互概述图(Interaction Overview Diagram)

    简介 交互概述图是将不同交互图衔接在一起的图,属于UML2.0的新增图.交互概述图并没有引入新的建模元素,其主要元素来自于活动图和时序图.交互概述图侧重从整体上概览交互过程中的控制流,包括交互图之间的 ...

  6. Distance on the tree

    Distance on the tree https://nanti.jisuanke.com/t/38229 DSM(Data Structure Master) once learned abou ...

  7. Redhat 7 开通防火墙端口

    1.查看防火墙状态,root用户登录,执行命令systemctl status firewalld 2.开启防火墙:systemctl start firewalld 3.关闭防火墙:systemct ...

  8. 1004: [HNOI2008]Cards - burnside + DP

    Description 小春现在很清闲, 面对书桌上的 \(N\) 张牌, 他决定给每张染色, 目前小春只有 \(3\) 种颜色: 红色, 蓝色, 绿色. 他询问 Sun 有 多少种染色方案, Sun ...

  9. 201771010134杨其菊《面向对象程序设计(java)》第十七周学习总结

    第十七周学习总结 1. 程序是一段静态的代码,它是应用程序执行的蓝本.进程是程序的一次动态执行,它对应了从代码加载.执行至执行完毕的一个完整过程.操作系统为每个进程分配一段独立的内存空间和系统资源,包 ...

  10. 涂色(CQOI2007)

    --BZOJ1260_区间dp Description 假设你有一条长度为5的木版,初始时没有涂过任何颜色.你希望把它的5个单位长度分别涂上红.绿.蓝.绿.红色,用一个长度为5的字符串表示这个目标:R ...