在Python中,对这两个东西有明确的规定: 函数function —— A series of statements which returns some value to a caller. It can also be passed zero or more arguments which may be used in the execution of the body. 方法method —— A function which is defined inside a class body…
<os和sys的官方解释> ➤os os: This module provides a portable way of using operating system dependent functionality. 这个模块提供了一种方便的使用操作系统函数的方法. ➤sys sys: This module provides access to some variables used or maintained by the interpreter and to functions that…
Python中,对象的赋值,拷贝(深/浅拷贝)之间是有差异的,如果使用的时候不注意,就可能产生意外的结果.下面本文就通过简单的例子介绍一下这些概念之间的差别. 对象赋值 直接看一段代码: will = ["Will", 28, ["Python", "C#", "JavaScript"]] wilber = will print id(will) print will print [id(ele) for ele in wil…