![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python
在学
moon__________
这个作者很懒,什么都没留下…
展开
-
anaconda使用教程
见此博客原创 2021-10-05 13:38:52 · 138 阅读 · 0 评论 -
Python类知识
类构造方法和析构方法类的方法静态方法内置属性类变量对象的属性管理 类也是一个对象 构造方法和析构方法 def __init__(self [, 形参列表]): #构造方法 语句... __del__(self): #析构方法 #不建议在析构方法中进行操作,因为析构调用的时间 #即对象销毁的时间不确定 类的方法 class Dog: local = "China" def __init__(self,a): self.age = a @classmethod #表明是类方法原创 2021-06-11 20:42:24 · 76 阅读 · 1 评论 -
Python3中range()
l=[0,1,2,3,4,5] for i in l: print(i,end=",") l.remove(i) #输出为0,2,4看出range()遍历是根据于l中元素的位置原创 2021-06-10 19:14:10 · 62 阅读 · 0 评论 -
函数模块包
函数模板包函数传参星号元组形参 函数 传参 def hello(a,b,c): print(a,b,c) 1位置传参 hello(a,b,c) #正确 #错误 hello(a,b) hello(a,b,c,d) #参数不能多不能少 2关键字传参 hello(a=1,b=2,c=3) hello(b=2,a=1,c=3) #都正确 #直接通过形参名称赋值,顺序无关,同样不能多或少 3序列传参 #可通过list、tuple、str传参 hello(*list) hello(*tup原创 2021-06-10 00:33:21 · 50 阅读 · 0 评论 -
py3小知识点
get(key) #返回键的值,若无键key返回None原创 2021-06-09 18:37:34 · 65 阅读 · 0 评论 -
Python 中达到CPP的while(cin)
while True: try: ''' 代码块 ''' a = input() except EOFError: break原创 2021-06-09 18:11:25 · 342 阅读 · 0 评论 -
Python3基础
Python3学习print() print() print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False) 调用参数输出 print("第{}期,当期存入{}元,账户累计{}元".format(nper,current_money,total_money)) 格式化输出 >>> pi = 3.141592653 >>> print('%10.3f' % pi) #字段宽10,精度3原创 2021-06-06 01:58:09 · 70 阅读 · 0 评论