上一页 1 ··· 25 26 27 28 29 30 31 32 33 ··· 65 下一页
摘要: class student: name=None def say_hi(self,msg): print(f"大家好呀,我是:{self.name},{msg}") stu=student() stu.name='fqs' stu.say_hi("我想死大家了") #设计一个闹钟 class Clo 阅读全文
posted @ 2023-07-06 16:14 胖豆芽 阅读(2) 评论(0) 推荐(0) 编辑
摘要: student_info={ 15:{'jack','rose',}, 18:{'jj'}, 35:{'a','b','c','d'}, } age_counts = {}# 定义一个字典 key=age value=name的长度 for age in student_info: count = 阅读全文
posted @ 2023-07-05 21:51 胖豆芽 阅读(14) 评论(0) 推荐(0) 编辑
摘要: import os os.system('mspaint D:\\1\\1.png') print('after call') ''' 打开一个图片 关闭后输出 after call ''' 阅读全文
posted @ 2023-07-05 20:47 胖豆芽 阅读(3) 评论(0) 推荐(0) 编辑
摘要: try: b=4/0 except ZeroDivisionError: print("获取 ZeroDivisionError ") ''' 获取 ZeroDivisionError ''' try: b=4/0 except ZeroDivisionError as e:# 获取更详细的信息 p 阅读全文
posted @ 2023-07-05 20:11 胖豆芽 阅读(1) 评论(0) 推荐(0) 编辑
摘要: 读相关fp=open('D:/1/1.txt') #获取前两个字符 str1=fp.read(2) print(str1) #获取前两个字符 str2=fp.read(2) print(str2) #获取前两个字符获取剩余的全部字符 str3=fp.read() print(str3) #打开后 关 阅读全文
posted @ 2023-07-05 18:07 胖豆芽 阅读(13) 评论(0) 推荐(0) 编辑
摘要: # 长度 数组的长度 len1=len([0,1,2,3,4]) print(len1) max1=max([0,1,2,3,4]) print(max1) min1=min([0,1,2,3,4]) print(min1) # 长度 元祖的长度 len1=len((0,1,2,3,4)) prin 阅读全文
posted @ 2023-07-05 16:46 胖豆芽 阅读(1) 评论(0) 推荐(0) 编辑
摘要: def fun(name,age,**kwargs): return kwargs print(fun('fqs','18',address="beijing",school='xy')) ''' {'address': 'beijing', 'school': 'xy'} ''' # 函数 不确定 阅读全文
posted @ 2023-07-05 16:02 胖豆芽 阅读(9) 评论(0) 推荐(0) 编辑
摘要: # 函数 在函数里设置全局变量,会因为被赋值而修改 x=2 def funcx(): global x #这个x 是全局变量 会因为函数里面被赋值而修改 x=9 print("this x is in the funcx:-->",x) funcx() print(" ") print("this 阅读全文
posted @ 2023-07-05 12:23 胖豆芽 阅读(4) 评论(0) 推荐(0) 编辑
摘要: # 函数 传参 def foo1(name,address): print(name,address) # 直接传入参数 foo1('fqs',"huilongguan") # 关键字传入参数 foo1(name='doudou',address='huilongguan') ''' fqs hui 阅读全文
posted @ 2023-07-05 11:19 胖豆芽 阅读(1) 评论(0) 推荐(0) 编辑
摘要: # continue 仅终止内循环 放遇到Lucy时 跳过;继续下个循环boys=['mike','jack','tom']girls=['lily','lucy','mary']for boy in boys: for girl in girls: if girl == 'lucy': conti 阅读全文
posted @ 2023-07-04 21:07 胖豆芽 阅读(6) 评论(0) 推荐(0) 编辑
上一页 1 ··· 25 26 27 28 29 30 31 32 33 ··· 65 下一页