今天尝试使用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. 关于微博api中发布话题的api问题

    https://api.weibo.com/2/statuses/update.json 发布过程中出现的问题 必须在连接加上发布的,access_token,status 例如 https://ap ...

  2. UniRX简述

    UniRX:是一个Unit3D的编程框架,专注于解决异步逻辑,使得异步逻辑的实现更加简单优雅. 例如:实现“只处理第一次鼠标点击事件”: Observable.EveryUpdate() .Where ...

  3. CCS 6新建文件自动生成注释

    对于CCS6,可以通过配置,达到新建源文件或者头文件时,自动生成适当的注释: 一.新建源文件自动生成配置. 在某个文件夹下右击选择 New - Source File. 点击 Configure,再选 ...

  4. jQuery取得radio的值 取select得值

    获取一组单选按钮对象: var obj_payPlatform = $('#wrap input[name="payMethod"]'); 获取被选中按钮的值 : var val_ ...

  5. MongoDB - 1

    MongoDB - 1   一.初识MongoDB 之 什么东西都得先从理论入手,你说是不是啊? MongoDB 是一个基于分布式文件存储的数据库.由 C++ 语言编写.旨在为 WEB 应用提供可扩展 ...

  6. 企业BGP网络规划案例(二)

    设计思路梳理 1.AS的划分 : 由于该办公网物理上被划分为总部和两个异地的办公分支,总部和分支互联采用MSTP线路,为了方便管理和更为灵活的进行路由控制,选择BGP作为总部和分支的路由协议.关于AS ...

  7. layabox typescript 安装固定版本

    安装最新版本方法: https://blog.csdn.net/adelais__/article/details/79181474 固定版本(比如2.1.5): C:\Users\Administr ...

  8. 1. String可调用方法

    class str(basestring): """ str(object='') -> string Return a nice string represent ...

  9. 使用WinMerge作为git的Merge工具

    使用WinMerge作为git的Merge工具 我比较喜欢使用免费的WinMerge作为diff和merge工具,虽然TortoiseGit也自己带了TortoiseGitMerge工具,但是使用起来 ...

  10. 【JavaWeb】防止表单的重复提交

    https://www.cnblogs.com/yfsmooth/p/4516779.html 看了以下别人给的总结: 客户端上防止提交: 1.js控制阻止 2.设置HTTP报头,控制表单缓存,使得所 ...