python追加元素到列表的方法
发布时间:2020-12-16 21:45:47 所属栏目:Python 来源:网络整理
导读:本篇章节讲解python追加元素到列表的方法。供大家参考研究。具体实现方法如下: scores = ["1","2","3"]# add a scorescore = int(raw_input("What score did you get: "))scores.append(score)# list high-score tablefor score in scores: print s
本篇章节讲解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 运行结果如下: What score did you get?: 5 1 2 3 5 希望本文所述对大家的Python程序设计有所帮助。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- python – PySpark可以使用numpy数组吗?
- 【python】RuntimeError: Lock objects should only be sha
- 截至2014年6月,应该考虑使用哪些工具来提高Python代码性能?
- python 浅析__get__,__getattr__,__getattribute__用法区别
- python数据化运营的重要意义
- python实现TCP服务器端与客户端的方法详解
- python自定义类并使用的方法
- python – 填写pandas数据帧中的日期空白
- python – 如何为我的绘图中的每一行的Y轴标签排序不同?
- python – 在分配和交换法则下查找等效结果