摘要: 1.列表的使用 shoplist = ['apple','mango' ,'carrot','banana']print ('I have ',len(shoplist),'items to purchase') print ('These items are:',)for item in shop 阅读全文
posted @ 2017-11-18 15:59 Carzy_Learner 阅读(503) 评论(0) 推荐(0) 编辑
摘要: 1.新建自己的模块 def sayhi(): print ('Hi, this is mymodule speaking.') Version = '0.1' 调用自己的模块 import mymodule mymodule.sayhi()print ('Version ', mymodule.Ve 阅读全文
posted @ 2017-11-18 15:46 Carzy_Learner 阅读(82) 评论(0) 推荐(0) 编辑
摘要: 1.全局变量写法 def func(): global x print ('x is',x) x=2 print ('Changed local x to', x)x= 50func()print ('x is still' ,x ) 2.改变形参和不改变形参设默认值用法 def say(messa 阅读全文
posted @ 2017-11-18 15:18 Carzy_Learner 阅读(84) 评论(0) 推荐(0) 编辑