![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python
bbs598598
这个作者很懒,什么都没留下…
展开
-
Python basic note 01
如果字符串里面有很多字符都需要转义,就需要加很多\,为了简化,Python还允许用r''表示''内部的字符串默认不转义,可以自己试试: >>> print('\\\t\\') \ \ >>> print(r'\\\t\\') \\\t\\ 如果字符串内部有很多换行,用\n写在一行里不好阅读,为了简化,Python允许用'''...'''的格式表示多行内容,可以自己试试: >>>转载 2016-07-08 23:17:02 · 518 阅读 · 0 评论 -
Python note 02
set和dict类似,也是一组key的集合,但不存储value。由于key不能重复,所以,在set中,没有重复的key。 >>> s = set([1, 2, 3]) >>> s {1, 2, 3} dict >>> d = {'Michael': 95, 'Bob': 75, 'Tracy': 85} >>> d['Michael'] 95 list>>> classmates = [转载 2016-07-10 21:20:13 · 314 阅读 · 0 评论 -
Python note03
Function def power(x): def power(x, n):默认参数def power(x, n=2):默认参数必须指向不变对象! 可变参数def calc(numbers): 首先想到可以把a,b,c……作为一个list或tuple传进来 def calc(*numbers): 可变参数 如果已经有一个list或者tuple,要调用一个可变参数怎么办?可以这转载 2016-07-12 22:04:54 · 345 阅读 · 0 评论