笔记三:函数
笔记二已取消置顶链接地址:http://www.cnblogs.com/dzzy/p/5289186.html
函数的作用:
給代码段命名,就像变量給数字命名一样
可以接收参数,像argv那样
创建脚本小程序
基础的函数用法:
#-*- coding:utf-8 -*-
def print_two(*args):
arg1,arg2=args
print "arg1:%s arg2:%s" %(arg1,arg2) def print_two_again(arg1,arg2):
print "arg1:%s arg2:%s\n" %(arg1,arg2) def print_one(arg1):
print "arg1:%s\n" %arg1 def print_none():
print "shit" print_two("hahaha","")
print_two_again("hahaha","")
donser=raw_input("input:")
print_one(donser)
print_none()