python面试题总结
来源:互联网 发布:mars软件 编辑:程序博客网 时间:2024/05/18 01:38
1.lambda函数
-匿名函数
a=lambda x,y:x+y
a(3,5)
8
2.python里tuple和list的转换
-用type()可判断类型
-用tuple()和list()可转换
3.删除list里的重复元素
-set函数
L1=[1,3,10,3,6,8,2,5,6]
set(L1)
set([1, 2, 3, 5, 6, 8, 10])
4.python里复制对象
-赋值(=),创建了对象的新引用,修改其中一个会影响到另外一个
-浅拷贝,创建新对象,但包含的是对原始对线中包含项的引用,可以使用完全切片法
L1=[10,3,8,25,7]
L2=L1[:]
L2.append(13)
L2
[10, 3, 8, 25, 7, 13]
L1
[10, 3, 8, 25, 7]
L3=L1
L3
[10, 3, 8, 25, 7]
L3.append(2)
L3
[10, 3, 8, 25, 7, 2]
L1
[10, 3, 8, 25, 7, 2]
0 0
- python 面试题总结
- Python面试题总结
- python面试题总结
- Python面试题总结
- Python面试题总结
- 12道 Python面试题总结
- 总结python中基本的面试题
- 网络上总结python中的面试题
- 【Python环境】12道 Python面试题总结
- 面试题总结-搜狐手机网Python开发工程师
- Python面试题
- python面试题
- Python面试题集合
- Python面试题集合
- python面试题
- Python面试题集合
- python面试题大全
- python面试题
- 设计模式六大原则
- 使用手机号登录、注册、重置密码
- Java多线程(九)——wait() notify() notifyAll()
- log4j.properties配置详解
- 物联网已到风口期,平台生态哪家强
- python面试题总结
- 中标麒麟下编译Qt遇到的问题
- java 读取properties文件属性
- SQL Server判断对象是否存在
- php中cookie和session使用范例
- 关于 App 程序员泡沫
- 主题模型-LDA浅析
- 下拉刷新
- Burp Suite抓取gzip数据包