![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python学习1
CALL_ME_K
这个作者很懒,什么都没留下…
展开
-
【14】Python学习笔记:函数作用域,匿名函数,函数式编程,高阶函数,尾递归优化,map,filter,reduce函数
函数作用域函数的作用域只跟函数声明时定义的作用域有关,跟函数的调用位置无任何关系。name = 'alex'def foo(): name = 'lhf' def bar(): name = 'wupeiqi' print(name) def tt(): print(name) ...原创 2018-08-14 12:42:48 · 251 阅读 · 0 评论 -
【13】Python学习笔记:局部变量与全局变量,函数递归,前向引用
局部变量与全局变量name='海风'def huangwei(): name = "黄伟" print(name) def liuyang(): name = "刘洋" print(name) def nulige(): name = '炉指花' print(name)...原创 2018-08-14 10:36:15 · 292 阅读 · 0 评论 -
【12】Python学习笔记:字符串格式化,set常用方法,函数定义
字符串格式化# 字符串格式化tpl = "I am {name}, age {age}, really {name}".format(name="seven", age=18)# 字符串格式化,使用字典时要带上**tpl = "I am {name}, age {age}, really {name}".format(**{"name": "seven", "age": 18原创 2018-08-14 10:13:22 · 314 阅读 · 0 评论 -
【08】Python学习笔记:dict方法汇总
dict方法汇总 class dict(object): """ dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable)...原创 2018-08-01 11:29:05 · 228 阅读 · 0 评论 -
【07】Python学习笔记:tuple方法汇总
tuple方法汇总 class tuple(object): """ tuple() -> empty tuple tuple(iterable) -> tuple initialized from iterable's items If the argument is a tuple, the return value is the...原创 2018-08-01 10:34:21 · 285 阅读 · 0 评论 -
【06】Python学习笔记:list方法汇总
list方法汇总 class list(object): """ list() -> new empty list list(iterable) -> new list initialized from iterable's items """ def append(self, p_object): # real signature u...原创 2018-08-01 09:51:15 · 180 阅读 · 0 评论 -
【05】Python学习笔记:str方法汇总
str方法汇总 class str(object): """ str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str Create a new string object from the given object. If encoding or...原创 2018-08-01 09:48:36 · 486 阅读 · 0 评论 -
【10】Python学习笔记:简单的多级目录(字典嵌套)
简单的多级目录(字典嵌套)# 创建多级目录,具有增加节点,查看节点,及返回上一级的功能db = { '北京' : {}, '上海' : {}, '广州' : { '天河区' : {}, '荔湾区' : {}, '白云区' : { '白云山' : {} } }}path...原创 2018-08-04 19:38:55 · 2642 阅读 · 1 评论 -
【09】Python学习笔记:一些常用的魔法方法
一、列表append# 1. append 在原列表末尾处追加新值li = [11, 22, 33, 22, 44]li.append(5)li.append("alex")li.append([1234,2323])print(li) extend# 5. extend 扩展原列表,参数为可迭代对象li = [11, 22, 33, 22, 44]li.a...原创 2018-08-04 19:12:17 · 172 阅读 · 0 评论 -
【04】Python学习笔记:基础知识练习题(一)
基础知识练习题(一) 1. 执行Python脚本的两种方式(1)命令行交互:将Python加入环境变量后,在cmd命令行输入python 文件路径即可。 如:python C:\Users\CALL_ME_K\PycharmProjects\Python_FullStack\day10\day10_s1.py(2)打开IDLE后,新建脚本,输入代码,完成保存,然后点击Run M...原创 2018-07-30 11:31:01 · 2271 阅读 · 2 评论 -
【03】Python学习笔记:字符串及其魔法方法2
join方法# join将字符串中的每一个元素按照指定的分隔符进行拼接test = "Hello World"print(test)v = "_".join(test)print(v) split/lsplit/rsplit方法# split/lsplit/rsplit以指定字符进行分割,但不获取该字符,可指定分割次数test = "Hello World"v1 =...原创 2018-07-26 19:15:45 · 223 阅读 · 0 评论 -
【02】Python学习笔记:字符串及其魔法方法1
capitalize方法# 首字母大写test = "alex"v = test.capitalize()print(v) lower与casefold方法# 整个字符串都变成小写# lower只支持26个英文字母的转换# casefold更强大,支持更多语言的小写S1 = "Runoob EXAMPLE....WOW!!!" # 英文S2 = "ß" # ...原创 2018-07-21 13:57:45 · 247 阅读 · 0 评论 -
【01】Python学习笔记:while循环语句练习题
练习题 1、使用while循环输入 1 2 3 4 5 6 8 9 10n = 1while n < 11: if n == 7: print(" ") else: print(n) n = n + 1 这里值得注意的一点是,python里面并不支持诸如n++或++n这样的操作,原因可能是:pyth...原创 2018-07-20 13:03:04 · 2218 阅读 · 0 评论 -
【11】Python学习笔记:set方法汇总
set方法汇总 class set(object): """ set() -> new empty set object set(iterable) -> new set object Build an unordered collection of unique elements. """ def add(self, *a...原创 2018-08-13 20:32:14 · 240 阅读 · 0 评论