开始
用power shell 启动 py
mkdir xx
cd fileee(用来存储py的文件夹)
python ex11.py
⬆可以直接得到上次输入的内容
习题12 raw_input
age=raw_input("who are you \n")
print "oh,you are %r,welcome" %(age)
wrong: %(age) forget
good: add \n,prettier
习题13 argv
from sys import argv
script,first,second,third = argv
print "script:",script
print "first;", first
print "second:", second
print "third:", third
POWERSHELL
python 2ex12.py aaa bbb ccc
wrong:import; 代码上一半的First second third可以更改,但必须对应; python后的为文件 输入输入数据
习题13 argv
from sys import argv
script,name = argv
prompt = '>'
print "hi,%s,i am %s" %(name, script)
print "let me ask you, do you like me, %s" %name
likes = raw_input(prompt)
print "why are you here? %s" %name
lives = raw_input(prompt)
print """
so you said %r,i am happy,and i am sorry %r
"""%(likes,lives)
wrong1:最后print漏了一个%r,
image/