我知道這是一個數據對象,但我是python的新手,我不明白user_output在做什麼。試圖理解這一切。什麼是這個對象?
def user_output(self,check): #data object
output = ""
#loop of all the info for __user_arr
for user in self.__user_arr:
if user.user_bot == str(check):
output += '''
<div class='about'>
<h1>{user.user_name}</h1>
<h2>My favorite band is: {user.user_band} </h2>
<div class='business'>
<p>Why I want the tickets:<br /> {user.user_business}</p>
</div>
</div>
'''
return output.format(**locals())
else: #this will spit an error if the user do not answer the last question correctly.
output = '''<div class='error'><h2>Turns out you are a robot. No tickets for you </h2></div>'''
return output
未來,請在詢問代碼之前閱讀[this](http://meta.stackoverflow.com/questions/253894/how-to-handle-explain-how-this-code-dump-works-questions)再次拋出問題。 – MattDMo 2014-10-20 22:26:42
對不起馬特我的錯誤。 – Surf3rDud3 2014-10-20 22:28:14