python--一些mark
来源:互联网 发布:儿童学编程网 编辑:程序博客网 时间:2024/05/16 05:09
>>> str
'wo xihuan python '
>>> str2 = str[3:6] + 'cha ru de ' + str[7:]
>>> str2
'xihcha ru de an python '
>>>
'U love me'
>>> "{a} love {b}".format(a="U",b='me')
'U love me'
>>> "{0:.1f}{1}".format(27.658,'GB')
'27.7GB'
>>> '%d + %d =%d' % (4,5,4+5)
'4 + 5 =9'
>>>
>>> b = 'wo xi huan daota'
>>> a = list(b)
>>> a
['w', 'o', ' ', 'x', 'i', ' ', 'h', 'u', 'a', 'n', ' ', 'd', 'a', 'o', 't', 'a']
>>> len(a)
16
>>> max(a)
'x'
>>> mix(a)
Traceback (most recent call last):
File "<pyshell#230>", line 1, in <module>
mix(a)
TypeError: 'list' object is not callable
>>> min(a)
' '
>>> tu = (1,2,3,4,5,6)
>>> max(tu)
6
>>> 6
6
>>> tu.append('a')
Traceback (most recent call last):
File "<pyshell#235>", line 1, in <module>
tu.append('a')
AttributeError: 'tuple' object has no attribute 'append'
>>> tu.append('a')
Traceback (most recent call last):
File "<pyshell#236>", line 1, in <module>
tu.append('a')
AttributeError: 'tuple' object has no attribute 'append'
>>> sum(tu)
21
>>> sum(tu,8)
29
>>> sorted(tu)
[1, 2, 3, 4, 5, 6]
>>> sorted(tu)
[1, 2, 3, 4, 5, 6]
>>> a = [1,2,3,4]
>>> b = [2,3,4,5,6,]
>>> zip(a,b)
<zip object at 0x02DB2170>
>>> zip(b,a)
<zip object at 0x02DB2300>
>>> list(zip(a,b))
[(1, 2), (2, 3), (3, 4), (4, 5)]
>>>
- python--一些mark
- 一些题目,mark一下
- mark一些链接
- mark一些代码
- LigerDailog 一些Mark
- Mark一些网站
- npm一些常用命令-mark
- python爬虫网站mark
- Python 输入输出 Mark
- mark 一些常用webpage 备份
- mark 一个python 面试题
- android应用性能优化的一些mark
- 一些需要mark的文章 url
- 关于OpenWRT编译的一些Mark
- JavaScript——一些用法的Mark
- Mark关于mybatis的一些简单东西
- 【C++】指针的一些问题Mark
- Mark 一些有意思的深度学习方向
- How to extend an LVM disk on a RHEL guest machine running on VMware host?
- 架构设计:系统间通信(32)——其他消息中间件及场景应用(下2)
- 变焦与对焦
- 【设计模式小结】—-创建型模式
- 限制拖放UEditor的宽度不超过它的父容器大小
- python--一些mark
- TextView的drawableLeft使用选择器不起作用的解决办法
- 使用pydicom读取dicom文件,并对文件做一些简单操作
- Android 自制短信发送器
- PHP在mysql中的数据转义问题
- Spring是如何简化java开发的
- Hashtable 和 HashMap的区别
- maven冲突,maven依赖版本
- LeetCode-Hash-299. Bulls and Cows