摘要: ⾸先我们来理解下Python中的函数 def hi(name="yasoob"): return "hi " + name print(hi()) # output: 'hi yasoob' # 我们甚⾄可以将⼀个函数赋值给⼀个变量,⽐如 greet = hi # 我们这⾥没有在使⽤⼩括号,因为我们并不是在调⽤hi函数 # ⽽是在将它放在greet变量⾥头。我们尝试运⾏下这个 print(g... 阅读全文
posted @ 2018-11-09 22:47 anobscureretreat 阅读(1288) 评论(0) 推荐(0)
摘要: def hi(name="yasoob"): def greet(): return "now you are in the greet() function" def welcome(): return "now you are in the welcome() function" if name == "yasoob": ... 阅读全文
posted @ 2018-11-09 22:46 anobscureretreat 阅读(192) 评论(0) 推荐(0)
摘要: 输出: 阅读全文
posted @ 2018-11-09 22:45 anobscureretreat 阅读(160) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2018-11-09 11:43 anobscureretreat 阅读(1036) 评论(0) 推荐(0)