12 2019 档案

摘要:list.pop(obj=list[-1]) 默认为 index=-1 删除最后一个列表值 阅读全文
posted @ 2019-12-20 11:33 小马嘿 阅读(1482) 评论(0) 推荐(0)
摘要:name = "刚娘"def weihou(): name = "陈卓" def weiweihou(): nonlocal name # nonlocal,指定上一级变量,如果没有就继续往上直到找到为止 name = "冷静" weiweihou() print(name)print(name)w 阅读全文
posted @ 2019-12-18 19:12 小马嘿 阅读(197) 评论(0) 推荐(0)
摘要:# name='lhf'### def change_name():# global name# name='帅了一比'# print('change_name',name)# 阅读全文
posted @ 2019-12-17 21:03 小马嘿 阅读(208) 评论(0) 推荐(0)
摘要:y=2*x+1x=3y->7x=3y->7'''# def test(x):# '''# 2*x+1# :param x:整形数字# :return: 返回计算结果# '''# y=2*x+1# return y## def test():# '''# 2*x+1# :param x:整形数字# : 阅读全文
posted @ 2019-12-17 19:59 小马嘿 阅读(1273) 评论(0) 推荐(0)
摘要:# s=set('hello')# print(s)## s=set(['alex','alex','sb'])# print(s)# s={1,2,3,4,5,6}#添加# s.add('s')# s.add('3')# s.add(3)# print(s)# s.clear()# print(s 阅读全文
posted @ 2019-12-16 15:55 小马嘿 阅读(153) 评论(0) 推荐(0)
摘要:msg='i am %s my hobby is %s' % ('lhf','alex')# print(msg)## msg='i am %s my hobby is %s' % ('lhf',1)# msg='i am %s my hobby is %s' % ('lhf',[1,2])# pr 阅读全文
posted @ 2019-12-16 15:53 小马嘿 阅读(212) 评论(0) 推荐(0)
摘要:a="I am %s" %"你大爷" #百分号字符串连接print(a)#结果 I am 你大爷 %s 可以接收 所有类型的 %d 只能接收数字 阅读全文
posted @ 2019-12-16 15:43 小马嘿 阅读(313) 评论(0) 推荐(0)