第18个python程序:命名变量代码函数
来源:互联网 发布:淘宝客服销售技巧 编辑:程序博客网 时间:2024/05/22 13:39
[root@mysql1 pshell]# cat ex18.py
#!/usr/bin/env Python
#-*-coding:utf-8-*-
# this one is like your scripts with argv
def print_two(*args):
arg1,arg2=args
print "arg1: %r,arg2: %r" % (arg1,arg2)
#ok,that *args is actually pointless,we can just do this
def print_two_again(arg1,arg2):
print "arg1: %r,arg2: %r" % (arg1,arg2)
#this just takes one argument
def print_one(arg1):
print "arg1: %r" % arg1
# this one takes no arguments
def print_none():
print "i got nothin'."
print_two("zed","shaw")
print_two_again("zed","shaw")
print_one("first!")
print_none()
[root@mysql1 pshell]#
[root@mysql1 pshell]#
[root@mysql1 pshell]#
[root@mysql1 pshell]# python ex18.py
arg1: 'zed',arg2: 'shaw'
arg1: 'zed',arg2: 'shaw'
arg1: 'first!'
i got nothin'.
#!/usr/bin/env Python
#-*-coding:utf-8-*-
# this one is like your scripts with argv
def print_two(*args):
arg1,arg2=args
print "arg1: %r,arg2: %r" % (arg1,arg2)
#ok,that *args is actually pointless,we can just do this
def print_two_again(arg1,arg2):
print "arg1: %r,arg2: %r" % (arg1,arg2)
#this just takes one argument
def print_one(arg1):
print "arg1: %r" % arg1
# this one takes no arguments
def print_none():
print "i got nothin'."
print_two("zed","shaw")
print_two_again("zed","shaw")
print_one("first!")
print_none()
[root@mysql1 pshell]#
[root@mysql1 pshell]#
[root@mysql1 pshell]#
[root@mysql1 pshell]# python ex18.py
arg1: 'zed',arg2: 'shaw'
arg1: 'zed',arg2: 'shaw'
arg1: 'first!'
i got nothin'.
0 0
- 第18个python程序:命名变量代码函数
- 第19个python程序:函数和变量
- 笨方法学Python 习题 18: 命名、变量、代码、函数
- 笨方法学习Python-习题18: 命名、变量、代码、函数
- 第4个python程序:变量
- 第5个python程序:变量2
- Exercise 18:命名,变量,代码,函数
- 习题18 命名、变量、代码和函数
- 笨办法18命名、变量、代码、函数
- Learn Python The Hard Way学习(18) - 命名,变量,代码,函数
- 笨办法学python习题18 命名、变量、代码和函数
- python18 命名、变量、代码、函数
- exercise18 命名 变量 代码 函数
- 程序函数和变量的命名
- 第20个python程序:函数和文件
- 第21个python程序:函数可以返回东西
- 第35个python程序:分支和函数
- 第25个python程序
- Xcode 8遇见新问题打印 subsystem: com.apple.siri等
- apktool下载地址
- Android Studio 使用JNI
- Mybatis 生成Oracle 数据库代码生成器
- explain详解
- 第18个python程序:命名变量代码函数
- 应聘时漂亮的回答
- [leetcode] 402. Remove K Digits 解题报告
- 房地产库存两极分化态势明显
- 【VLC-Android】vlc-android简例
- 规格化数据方法
- 关于js导出excel的标题日期问题
- DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
- 手机短信验证登录