Python入門基礎學習:傳遞 argv函數

 

python腳步傳參數:

from sys import argv
user_name = argv
prompt = '> '
print( "Hi %s, I'm the script." % user_name)
#print( "I'd like to ask you a few questions.")
print('Do you like me %s ?' % user_name)
likes =input(prompt)
print ("Where do you live %s?" % user_name)
lives =input(prompt)
print( "What kind of computer do you have?")
computer =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))

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章