【Python】Learn Python the hard way, ex14 argv参数传值
来源:互联网 发布:勤思考研网络课程 编辑:程序博客网 时间:2024/05/21 09:46
from sys import argvscript, user_name = argvprompt = '>'print "Hi %s, I'm the %s script." % (user_name, script)print "I'd like to ask you a few questions."print "Do you like me %s?" % user_namelikes = raw_input (prompt)print "Where do you live %s?" % user_namelives = raw_input(prompt)print "What kind of computer do you have?"computer = raw_input (prompt)print """Alright, so you said %r about liking me.You live in %r. Not sure where that is.And you have a %r computer. Nice.""" % (likes, lives, computer)"""Test Result:Hi ghx, I'm the /Users/myRMBP/Desktop/ex14.py script.I'd like to ask you a few questions.Do you like me ghx?>yesWhere do you live ghx?>szWhat kind of computer do you have?>macAlright, so you said 'yes' about liking me.You live in 'sz'. Not sure where that is.And you have a 'mac' computer. Nice."""
心得:
通过argv传值应该可以用于混合编程,值得关注
0 0
- 【Python】Learn Python the hard way, ex14 argv参数传值
- Learn Python The Hard Way
- Learn Python The Hard Way
- 【Python】Learn Python the hard way, ex13 传递参数
- Learn Python the Hard Way ex48
- 学《learn python the hard way》(3)
- learn python the hard way 的ex48
- Learn Python The Hard Way-Ecercise1~5
- Learn Python The Hard Way-Ecercise6~10
- Learn Python The Hard Way-Ecercise11~15
- Learn Python The Hard Way-Ecercise16~20
- Learn Python The Hard Way-Ecercise21~25
- Learn Python The Hard Way-Ecercise26~30
- Learn Python The Hard Way-Ecercise31~35
- Learn Python The Hard Way-Ecercise36~40
- Learn Python The Hard Way exercise 42
- Learn Python The Hard Way Ex40翻译
- 《Learn Python the hard way》学习记录
- 11.14 MATLAB编译错误中英对照29
- 第二次实验内容
- 关于自己的学习oc的学习笔记 - NSCalendar
- 获取transform的各种函数如:translate(0px,0px)
- Oracle 数据库和补丁下载地址 12.1.0.2 11.2.0.4 11.2.0.1
- 【Python】Learn Python the hard way, ex14 argv参数传值
- awk--文本分析的ak47
- mac 您需要安装旧 Java SE 6 运行环境才能打开Android Studio,Intellij IDEA
- UVA 1610 Party Games
- 详解Android中AsyncTask的使用
- fzu2198(矩阵乘法模板)
- 微软今天的Windows 10硬件发布会汇总:手机瞬间变PC
- UVA - 12594 Naming Babies(斜率优化)
- Android大数据、断点续传、耗时下载之DownloadManager开发简介(1)