>>> def is_not_empty(s):
return s and len(s.strip()) > 0

>>> filter(is_not_empty, ['test', None, '', 'str', ' ', 'END'])
<filter object at 0x1056a3518>
>>> chr(0x1056a3518)
Traceback (most recent call last):
File "<pyshell#113>", line 1, in <module>
chr(0x1056a3518)
OverflowError: signed integer is greater than maximum
>>> hex(9)
'0x9'
>>> hex(226)
'0xe2'
>>> help(hex)
Help on built-in function hex in module builtins:

hex(number, /)
Return the hexadecimal representation of an integer.

>>> hex(12648430)
'0xc0ffee'

>>> input('please input keyword,thank you')
please input keyword,thank you02
'02'
>>> list([1,2,3])
[1, 2, 3]
>>> set([1.1,2,3])
{1.1, 2, 3}
>>> tuple([1,'str',5.0])
(1, 'str', 5.0)
>>> dict([2:1.2,5:3.2])
SyntaxError: invalid syntax
>>> dict([2:'name',3:'stress'])\

SyntaxError: invalid syntax
>>> dict([2 : 'name',3 : 'stress'])
SyntaxError: invalid syntax
>>> dict(a='a',b='b',t='t')
{'b': 'b', 't': 't', 'a': 'a'}
>>> a = set([(1,2)])
>>> dict(a)
{1: 2}
>>> a = [(1,'a'),['a',1]]
>>> dict(a)
{1: 'a', 'a': 1}
>>> a = ('ac',set('de'))
>>> dict(a)
{'e': 'd', 'a': 'c'}
>>> def f(x)
SyntaxError: invalid syntax
>>> def f(x):
return x*x

>>> print map(f,[1,2,3,4,5,6,7,8,8])
SyntaxError: invalid syntax
>>> max([2,4,6,8,9])
9
>>> min([1,0.5,8,6])
0.5
>>> a = iter('abcd')
>>> next(a)
'a'
>>> next(a)
'b'
>>> next(a)
'c'
>>> next(a)
'd'
>>> next(a,'e')
'e'
>>> sum([1,5,8,9])
23
>>> oct(138)
'0o212'
>>> ord('a')
97
>>> pow(2,3)
8
>>> range(1,3)
range(1, 3)
>>> range(1,5,2)
range(1, 5, 2)
>>> range(5)#not include five
range(0, 5)
>>> reversed
<class 'reversed'>
>>> reversed([1,2,3,4,5,6,7])
<list_reverseiterator object at 0x105686f60>
>>> round(1.5778,2)
1.58
>>> str(5648+)
SyntaxError: invalid syntax
>>> str(546)
'546'
>>> str(545.)
'545.0'
>>> type(str)
<class 'type'>
>>> type(132)
<class 'int'>
>>> x = [1,2,3]
>>> y = [4,5,6]
>>> z = [7,8,9]
>>> xyz = zip(x,y,z)
>>> print xyz
SyntaxError: Missing parentheses in call to 'print'
>>> print (xyz)
<zip object at 0x1056a8f08>
>>> import (sys.builtin_module_names)
SyntaxError: invalid syntax
>>> import sys
>>> print(sys.builtin_module_names)
('_ast', '_codecs', '_collections', '_functools', '_imp', '_io', '_locale', '_operator', '_signal', '_sre', '_stat', '_string', '_symtable', '_thread', '_tracemalloc', '_warnings', '_weakref', 'atexit', 'builtins', 'errno', 'faulthandler', 'gc', 'itertools', 'marshal', 'posix', 'pwd', 'sys', 'time', 'xxsubtype', 'zipimport')
>>> help('module')
No Python documentation found for 'module'.
Use help() to get the interactive help utility.
Use help(str) for help on the str class.

>>> help(_ast)
Traceback (most recent call last):
File "<pyshell#169>", line 1, in <module>
help(_ast)
NameError: name '_ast' is not defined
>>> help('_ast')

python_code list_1的更多相关文章

  1. python_code list_3

    >>> seq=['foo','x41','?','***']>>> def func(x): return x.isalnum() >>> li ...

  2. python_code list_2

    >>> import math>>> math.sin(0.5)0.479425538604203>>> >>> import ...

  3. python 数据类型 --- 集合

    1. 注意列表和集合的区别 set 列表表现形式: list_1 = [1,3,4];  集合表现形式:set_1= set() list_1 = [1,2,3,4,23,4,2] print(lis ...

  4. Basic Tutorials of Redis(6) - List

    Redis's List is different from C#'s List,but similar with C#'s LinkedList.Sometimes I confuse with t ...

  5. python基础之函数

    python 函数 函数是组织好的,可重复使用的,用来实现单一,或相关联功能的代码段. 函数能提高应用的模块性,和代码的重复利用率.你已经知道Python提供了许多内建函数,比如print().但你也 ...

  6. Python 数据类型及其用法

    本文总结一下Python中用到的各种数据类型,以及如何使用可以使得我们的代码变得简洁. 基本结构 我们首先要看的是几乎任何语言都具有的数据类型,包括字符串.整型.浮点型以及布尔类型.这些基本数据类型组 ...

  7. Python-09-线程、进程、协程、异步IO

    0. 什么是线程(thread)? 线程,有时被称为轻量级进程(Lightweight Process,LWP),是程序执行流的最小单元.一个标准的线程由线程ID,当前指令指针(PC),寄存器集合和堆 ...

  8. Python-03-基础

    一.集合 集合(set)是一个无序的.不重复的元素组合,它的主要作用如下: 去重:把一个列表变成集合,就会自动去重. 关系测试:测试两组数据之前的交集.差集.并集等关系. 常用操作 # 创建数值集合 ...

  9. Python学习Day2笔记(集合和文件操作)

    1.集合的使用 列表是有序的可包含重复内容的 集合是无序的不可包含重复内容的 1) 集合关系测试 #列表去重list_1=[1,4,5,6,7,8,9,7,5,4,23,2] #有重复数据 list_ ...

随机推荐

  1. AngularJS进阶(三十一)AngularJS项目开发技巧之获取模态对话框中的组件ID

    AngularJS项目开发技巧之获取模态对话框中的组件ID 需求 出于项目开发需求,需要实现的业务逻辑是:药店端点击查看"已发货""已收货"订单详情时,模块弹出 ...

  2. Xcode相关常用快捷键搜集

    command + L:  跳转到指定行     control + i:  格式化代码 command + control + 上/下 在*.h和*.m之间切换. command + control ...

  3. ViewPager适配器学习记录( pageAdapter和FragmentPagerAdapter/FragmentStatePagerAdapter))

    1.概述 ViewPager,顾名思义实现控件的滚动功能,是Support-v4的包中类,使用前要先导包.使用的时候跟listView有点相似,需要设置对应的适配器,通常有俩大类 [pageAdapt ...

  4. 【翻译】使用Sencha Touch创建基于Tizen应用程序

    原文:Building a Tizen App With Sencha Touch 作者:Gautam Agrawal Gautam Agrawal is Sencha's Sr. Product M ...

  5. ARC时代的内存管理

    什么是ARC Automatic Reference Counting (ARC) is a compiler feature that provides automatic memory manag ...

  6. LeetCode之“树”:Sum Root to Leaf Numbers

    题目链接 题目要求: Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represe ...

  7. ITU-T Technical Paper: QoS的构建模块与机制

    本文翻译自ITU-T的Technical Paper:<How to increase QoS/QoE of IP-based platform(s) to regionally agreed ...

  8. Linux本地网络脚本配置(内网与外网)

    脚本位于:     /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 //网卡的名字 BOOTPROTO=static // none静态IP ...

  9. windows的服务中的登录身份本地系统账户、本地服务账户和网络服务账户修改

    以一个redis服务为例: 一个redis注册服务后一般是网络服务账户,但是当系统不存在网络服务账户时,就会导致redis服务无法正常启动.接下来修改redis服务的登录身份. cmd下输入如下命令: ...

  10. Android+struts2+json方式模拟手机登录功能

    涉及到的知识点: 1.Struts2框架的搭建(包括Struts2的jSON插件) 2.Android前台访问Web采用HttpClient方式. 3.Android采用JSON的解析. 服务端主要包 ...