python笔记(6)--深浅拷贝和文件操作

时间:2019-10-08 20:38:35   收藏:0   阅读:84

深浅拷贝和文件操作

今日内容:

内容回顾&补充

1.内容回顾

2.面试题

  1. 公司线上的系统用的什么?

  2. python2和python3的区别?

    • 默认解释器编码
    • 输入输出
    • 整数的除法 / int long
  3. 运算符

    v = 1 or 0 and 8 or 9
    print(v)
  4. is 和 ==的区别?
  5. 列举python的数据类型中都有哪些方法?(重要)

今日内容

1.深浅拷贝

只有在嵌套的情况下深浅拷贝才有不同

#str + int + bool    因为都是不可变类型,拷贝结果是一样的,内存地址一样
a = "yanan"
b = copy.copy(a)
c = copy.deepcopy(a)
#list + set + dict  找到里面所有可变类型的copy一遍

2.文件操作

file_object.seek(3) #光标移动到第三个字节
data = file_object.tell() #获取光标目前的位置
print(data) #输出为3
#关闭文件
file_object.close()
```

3.文件修改

总结

原文:https://www.cnblogs.com/lynlearnde/p/11637286.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!