随笔分类 - python3.7
python3.7
摘要:python语言基础 (1)Python3入门,数据类型,字符串(2)判断/循环语句,函数,命名空间,作用域(3)类与对象,继承,多态(4)tkinter界面编程(5)文件与异常,数据处理简介(6)Pygame实战飞机大战,2048 python语言高级 (1)Python常见第三方库与网络编程(2
阅读全文
摘要:keys()描述 Python 字典(Dictionary) keys() 函数以列表返回一个字典所有的键。 语法 dict.keys() 例题 users = { 'username':'efermi', 'first':'enrico', 'last':'fermi',}for dict_key
阅读全文
摘要:1.一个简单的字典 alien_0 ={"color":"green","points" : 5}print(alien_0["color"])print(alien_0["points"])2.添加键-值对 alien_0 ={"color":"green","points" : 5}print(
阅读全文
摘要:简单的示例: cars = ['audi', 'bmw', 'subaru', 'toyota']for car in cars: if car == "bmw": print(car.upper()) else: print(car.title())1. 使用 使用and 检查多个条件 检查多个条
阅读全文
摘要:for 循环 magicians = ['alice', 'david', 'carolina']for magician in magicians: print(magician.title()+", that was a great trick!") print("I can't wait to
阅读全文
摘要:变量的命名和使用 在Python中使用变量时,需要遵守一些规则和指南。违反这些规则将引发错误,而指南旨在让你编写的代码更容易阅读和理解。请务必牢记下述有关变量的规则。 变量名只能包含字母、数字和下划线。变量名可以字母或下划线打头,但不能以数字打头,例如,可将变量命名为message_1,但不能将其命
阅读全文
浙公网安备 33010602011771号