会员
周边
新闻
博问
闪存
众包
赞助商
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
abel2020
博客园
首页
新随笔
联系
订阅
管理
上一页
1
···
6
7
8
9
10
11
12
13
14
下一页
2020年6月10日
13 全局变量修改
摘要: 1 局部变量各函数内部互不影响 2 函数内部与全部变量重名,局部的值有效 (同c) 3 如果需要修改全局变量: 加global , 所有受影响的地方会颜色一致凸显
阅读全文
posted @ 2020-06-10 00:29 abel2020
阅读(268)
评论(0)
推荐(0)
2020年6月9日
13 可变类型和不可变类型
摘要: 1 字符串,数字,元组 不可变,改变变量值,内存地址改变 2 列表,字典,可变,操作不会改变地址 3 字典的key 只能用不可变类型(因为py对 key 进行hash ,可变类型不能hash) ##列表操作>>> list=["a",1,2,"b"] >>> id(list) 14038619452
阅读全文
posted @ 2020-06-09 23:51 abel2020
阅读(168)
评论(0)
推荐(0)
12 函数返回值的地址引用
摘要: def fun(): s="python" print("%s address is %d" % (s,id(s))) return s f=fun() print("%s address is %d" % (f,id(f))) 运行结果: python address is 30498557801
阅读全文
posted @ 2020-06-09 23:01 abel2020
阅读(284)
评论(0)
推荐(0)
11 函数参数传递
摘要: a=10 print("%d address is %d" % (a,id(a))) def fun(num): print("%d address is %d" % (num,id(num))) fun(a) 运行结果: 10 address is 140706134913584 10 addre
阅读全文
posted @ 2020-06-09 22:46 abel2020
阅读(125)
评论(0)
推荐(0)
10 变量引用
摘要: a=1 print("a address is ",id(a)) b=a c=b print("b address is ",id(b)) print("c address is ",id(c)) 打印结果: a address is 140706134913296 #b c a 都指向 1 所在的
阅读全文
posted @ 2020-06-09 22:32 abel2020
阅读(99)
评论(0)
推荐(0)
9 名片处理系统,运行
摘要: ************************************************** 欢迎使用 名片管理系统 0. 退出 1. 新建名片 2. 显示全部 3. 查询名片**************************************************请选择:1您选的
阅读全文
posted @ 2020-06-09 18:37 abel2020
阅读(123)
评论(0)
推荐(0)
8 第一个py小程序,名片处理系统
摘要: ''' 我的第一个py小程序 名片处理系统 2020 06 09 main.py ''' #导入功能模块,单词处理每一部分功能 import cards_fun1 while True: #欢迎页面 cards_fun1.hy() # 请用户选择 num_input = input("请选择:")
阅读全文
posted @ 2020-06-09 18:30 abel2020
阅读(314)
评论(0)
推荐(0)
2020年6月8日
5 第一个模块
摘要: """ test1.py 注意缩进!! """ def pt_line(char,times,num): row=0 while row<num: print(char * times) row+=1 name ="my first module:" """ test2.py """ import
阅读全文
posted @ 2020-06-08 03:52 abel2020
阅读(107)
评论(0)
推荐(0)
6 函数调用1
摘要: def pt_line(c,times): #形参 print(c*times) times=5 char="*" row=0 while row<5: pt_line(char,times) # char ,times 实参 row+=1 循环里面的pt_line 执行时,传递参数进入第一行执行,
阅读全文
posted @ 2020-06-08 02:43 abel2020
阅读(92)
评论(0)
推荐(0)
5 while 及代码格式
摘要: py 根据缩进确定if 或者while 的范围 while 后面不用括号 ,使用分号 默认print 自动回车,如果不需要回车加上 ,end="" 不支持 i++ i=1;j=1 while i<=9: j=i while j<=9: print("%dX%d=%d "%(i,j,i*j),end=
阅读全文
posted @ 2020-06-08 01:41 abel2020
阅读(238)
评论(0)
推荐(0)
上一页
1
···
6
7
8
9
10
11
12
13
14
下一页
公告