python列表操作:追加元素到列表的代码

将做工程过程中常用的内容做个收藏,如下的内容是关于python列表操作:追加元素到列表的内容。

scores = ["1","2","3"]

# add a score
score = int(raw_input("What score did you get?: "))
scores.append(score)

# list high-score table
for score in scores:
       print score

猜你喜欢

转载自blog.51cto.com/14101311/2375098