11 2014 档案

摘要:可变参数def enroll(name, gender, age=6, city='Beijing'): print 'name:', name print 'gender:', gender print 'age:', age print 'city:', city调用:e... 阅读全文
posted @ 2014-11-11 11:15 一匹河马 阅读(207) 评论(0) 推荐(0) 编辑
摘要:1、适配中文#coding-utf-8#coding: utf-82、格式化输出,此时的转义字符不能用\,只能用%print 'growth rate : %d \%' % 753 True 和 Falseif x: print 'True'只要x是非零数值、非空字符串、非空list等,就判断... 阅读全文
posted @ 2014-11-09 19:51 一匹河马 阅读(183) 评论(0) 推荐(0) 编辑
摘要:如果按照下面方式,则无论你输入什么,都会打印12,因为raw_input接受的输入是按照字符串处理的num = raw_input('please enter a num:')if num > 10: print 12else: print -abs(int(num))需要改成下面的写法... 阅读全文
posted @ 2014-11-08 17:43 一匹河马 阅读(1800) 评论(0) 推荐(0) 编辑