[root@mysql1 pshell]# cat ex14.py
#!/usr/bin/env Python
#-*-coding:utf-8-*-
from sys import argv
script,user_name,user_id = argv
prompt = '>> '
print "hi %s, i'm the %s script. your id is %s" % (user_name, script, user_id)
print "i'd like to ask you a few questions."
print "do you like me %s?" % user_name
likes = raw_input(prompt)
print "where do you live %s?" % user_name
lives = 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)
[root@mysql1 pshell]#
[root@mysql1 pshell]#
[root@mysql1 pshell]#
[root@mysql1 pshell]#
[root@mysql1 pshell]# python ex14.py gw 110
hi gw, i'm the ex14.py script. your id is 110
i'd like to ask you a few questions.
do you like me gw?
>> yes
where do you live gw?
>> beijing
what kind of computer do you have?
>> sony
alright, so you said 'yes' about liking me.
you live in 'beijing'. not sure where that is.
and you have a 'sony' computer, nice.
#!/usr/bin/env Python
#-*-coding:utf-8-*-
from sys import argv
script,user_name,user_id = argv
prompt = '>> '
print "hi %s, i'm the %s script. your id is %s" % (user_name, script, user_id)
print "i'd like to ask you a few questions."
print "do you like me %s?" % user_name
likes = raw_input(prompt)
print "where do you live %s?" % user_name
lives = 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)
[root@mysql1 pshell]#
[root@mysql1 pshell]#
[root@mysql1 pshell]#
[root@mysql1 pshell]#
[root@mysql1 pshell]# python ex14.py gw 110
hi gw, i'm the ex14.py script. your id is 110
i'd like to ask you a few questions.
do you like me gw?
>> yes
where do you live gw?
>> beijing
what kind of computer do you have?
>> sony
alright, so you said 'yes' about liking me.
you live in 'beijing'. not sure where that is.
and you have a 'sony' computer, nice.