arlenmbx@arlenmbx-ThinkPad-X130e:~$ su root
密码:
root@arlenmbx-ThinkPad-X130e:/home/arlenmbx# python
Python 2.7.10 (default, Oct 14 2015, 16:09:02)
[GCC 5.2.1 20151010] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> dic={'f1':1,'f2':2,'f3':3}
>>> dic
{'f1': 1, 'f2': 2, 'f3': 3}
>>> for key in dic:
... print dic[key]
...
1
2
3
>>> print dic.keys()
['f1', 'f2', 'f3']
>>> print dic.values()
[1, 2, 3]
>>> print dic.items()
[('f1', 1), ('f2', 2), ('f3', 3)]
>>> dic.clear()
>>> print dic
{}
>>> type(dic)
<type 'dict'>
>>> f=open("a.py","r+")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IOError: [Errno 2] No such file or directory: 'a.py'
>>> f=open("a.txt","r+")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IOError: [Errno 2] No such file or directory: 'a.txt'
>>> f=open("/home/arlenmbx/桌面/pro.txt","r+")
>>> f.write("hello world")
>>> f.close()
>>> chmod 755 python
File "<stdin>", line 1
chmod 755 python
^
SyntaxError: invalid syntax
>>> exit()
root@arlenmbx-ThinkPad-X130e:/home/arlenmbx# chmod 755 b.py
chmod: 无法访问"b.py": 没有那个文件或目录
root@arlenmbx-ThinkPad-X130e:/home/arlenmbx# cd /home/arlenmbx/桌面
root@arlenmbx-ThinkPad-X130e:/home/arlenmbx/桌面# dir
a.py a.py~ b.py b.py~ pro.txt
root@arlenmbx-ThinkPad-X130e:/home/arlenmbx/桌面# chmod 755 b.py
root@arlenmbx-ThinkPad-X130e:/home/arlenmbx/桌面# ./b.py
hha
hha
hha
hha
hha
hha
hha
hha
hha
hha
root@arlenmbx-ThinkPad-X130e:/home/arlenmbx/桌面# import b as bb
程序 'import' 已包含在下列软件包中:
* imagemagick
* graphicsmagick-imagemagick-compat
请尝试:apt-get install <选定的软件包>
root@arlenmbx-ThinkPad-X130e:/home/arlenmbx/桌面# python
Python 2.7.10 (default, Oct 14 2015, 16:09:02)
[GCC 5.2.1 20151010] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> def f(a,b,c):
... print a
... print b
... print c
...
>>> f(1,2,3)
1
2
3
>>> f(a=3,b=2,c=1)
3
2
1
>>> print(c=1,b=3,a=2)
File "<stdin>", line 1
print(c=1,b=3,a=2)
^
SyntaxError: invalid syntax
>>> f(c=1,b=3,a=2)
2
3
1
>>> def fun(*p):
... type(p)
... print p
...
>>> fun(1,2,3)
(1, 2, 3)
>>> def fun(*p):
... print type(p)
... print p
... fun(1,2,3,4)
File "<stdin>", line 4
fun(1,2,3,4)
^
SyntaxError: invalid syntax
>>> fun(1,2,3,4)
(1, 2, 3, 4)
>>> fun(1,2,4,3,4,5)
(1, 2, 4, 3, 4, 5)
>>> def fun1(**p):
... print type(p)
... print p
...
>>> fun1(1,2,)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: fun1() takes exactly 0 arguments (2 given)
>>> fun1(1,2,3)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: fun1() takes exactly 0 arguments (3 given)
>>> fun1(a=1,b=2)
<type 'dict'>
{'a': 1, 'b': 2}
>>>
>>> def fun2(a,b,c):
... print a
... print b
... print c
...
>>> t=(3,4,5)
>>> fun2(*t)
3
4
5
>>>

python 模块包裹的更多相关文章

  1. 使用C/C++写Python模块

    最近看开源项目时学习了一下用C/C++写python模块,顺便把学习进行一下总结,废话少说直接开始: 环境:windows.python2.78.VS2010或MingW 1 创建VC工程 (1) 打 ...

  2. Python模块之configpraser

    Python模块之configpraser   一. configpraser简介 用于处理特定格式的文件,其本质还是利用open来操作文件. 配置文件的格式: 使用"[]"内包含 ...

  3. Python模块之"prettytable"

    Python模块之"prettytable" 摘要: Python通过prettytable模块可以将输出内容如表格方式整齐的输出.(对于用Python操作数据库会经常用到) 1. ...

  4. python 学习第五天,python模块

    一,Python的模块导入 1,在写python的模块导入之前,先来讲一些Python中的概念性的问题 (1)模块:用来从逻辑上组织Python代码(变量,函数,类,逻辑:实现一个功能),本质是.py ...

  5. windows下安装python模块

    如何在windows下安装python模块 1. 官网下载安装包,比如(pip : https://pypi.python.org/pypi/pip#downloads) pip-9.0.1.tar. ...

  6. 安装第三方Python模块,增加InfoPi的健壮性

    这3个第三方Python模块是可选的,不安装的话InfoPi也可以运行. 但是如果安装了,会增加InfoPi的健壮性. 目录 1.cchardet    自动检测文本编码 2.lxml    用于解析 ...

  7. Python基础篇【第5篇】: Python模块基础(一)

    模块 简介 在计算机程序的开发过程中,随着程序代码越写越多,在一个文件里代码就会越来越长,越来越不容易维护. 为了编写可维护的代码,我们把很多函数分组,分别放到不同的文件里,这样,每个文件包含的代码就 ...

  8. python 模块加载

    python 模块加载 本文主要介绍python模块加载的过程. module的组成 所有的module都是由对象和对象之间的关系组成. type和object python中所有的东西都是对象,分为 ...

  9. pycharm安装python模块

    这个工具真的好好,真的很喜欢,它很方便,很漂亮,各种好 pycharm安装python模块:file-setting-搜索project inte OK

随机推荐

  1. 使用SharpPCap在C#下进行网络抓包

    在做大学最后的毕业设计了,无线局域网络远程安全监控策略那么抓包是这个系统设计的基础以前一直都是知道用winpcap的,现在网上搜了一下,有用C#封装好了的,很好用下面是其中的几个用法这个类库作者的主页 ...

  2. [转]Excel导入异常Cannot get a text value from a numeric cell解决

    原文地址:http://blog.csdn.net/ysughw/article/details/9288307 POI操作Excel时偶尔会出现Cannot get a text value fro ...

  3. Android 解析聊天表情的笔记

    应用需要用到聊天功能,考虑到开始需求不大,暂时先用第三方的. 一研究发现界面风格有点不符合整体的风格,加上需要一些自己的特定的需求和界面显示,于是就决定调用第三方数据接口,界面自己写.功能只需要文字, ...

  4. com/android/dx/command/dexer/Main : Unsupported major.minor version 52.0

    这是由于JDK版本不一致造成的,指的是高版本的JDK编译的class不能放在低版本的JDK上运行. Version 52,表示JDK8编译的class不能运行在JDK7上,所以需要在本地安装JDK8.

  5. table里面,怎么根据checkbox选择的一行中的某个单元格的值是否为空,来判断是否该选中

    <table class="stripe" id="tab2"> <tr> <th>选择</th> <th ...

  6. SmartAssembly使用失败记录

    目标:将指定程序集混淆,禁止反编译 1.下载软件 www.red-gate.com 官网下载 因为不常用,所以用的14天试用版 2.前面的照着下面的教程,一直到第四步 http://www.cnblo ...

  7. 如何运行Spark程序

    [hxsyl@CentOSMaster spark-2.0.2-bin-hadoop2.6]# ./bin/spark-submit --class org.apache.spark.examples ...

  8. 谈iOS抓包:Mac下好用的HTTP/HTTPS抓包工具Charles

    在Mac下做开发,用Fiddler抓包由于离不开Windows比较痛苦,还好有Charles,到官网http://www.charlesproxy.com/可下载到最新版本(若不支持rMBP可拖到Re ...

  9. BZOJ2117: [2010国家集训队]Crash的旅游计划

    裸点分,点分树每层维护有序表,查询二分,复杂度$O(nlog^3n)$. #include<bits/stdc++.h> #define M (u+v>>1) #define ...

  10. 纯CSS3实现动态导航栏目

    <!doctype html> <html lang="en"> <head> <meta charset="UTF-8&quo ...