Python01---基础

1.pip:安装包/安装本地包/换源/配置文件

https://www.cnblogs.com/springsnow/p/11883954.html

2.格式化输出

print:end不换行/sep间隔符

rjust,ljust,center:字符串格式化填充空格

zfill:填充0

format:格式化输出{位置:格式}

https://www.cnblogs.com/springsnow/p/11881196.html

3.标识符

单下划线:from moduleName import * “将不会引入以单下划线”_"开头的函数,变量可以直接使用。

import moduleName,不可以通过模块名调用_函数

https://blog.csdn.net/brucewong0516/article/details/79120841

双下划线:类的私有属性,私有方法不会继承覆盖。

https://www.cnblogs.com/springsnow/p/11881196.html

4.保留字符

  • and、exec、not、assert、finally、or、break、for、pass、class、from、print、continue、global、raise、def、
  • if、return、del、import、try、elif、in、while、else、is、with、except、lambda、yield

 5.转义

r不转义 默认转义

6.多行语句

+/ 反斜杠  [] () {}没有

7.三元表达式

x if x > y else y

8.导入模块

目的都是导入函数 form 和直接import一样

https://www.cnblogs.com/springsnow/p/11881196.html

9.assert

assert condition == if not condition rasie

https://www.cnblogs.com/hezhiyao/p/7805278.html

10.变量与赋值

不用提前声明,使用的时候要赋值

常量:约定全部大写

交叉赋值:临时变量

多变量赋值:a,b=b,a+b

https://www.cnblogs.com/springsnow/p/11883570.html

11.f前缀字符串比%,format跟好

https://www.jianshu.com/p/eca123adccc7

12.运算符:// 取整 %取余 **幂 ^异或 |或 &且

13.解包:list,dict,set,tuple必须确定,dict是key

_代表一个,*_代表任意多个

解包操作很强大,只要是可迭代对象就可以

https://www.cnblogs.com/TMesh/p/11731018.html

https://www.cnblogs.com/springsnow/p/11883570.html

14.while---else----:如果没有break才执行

https://www.cnblogs.com/springsnow/p/11883570.html

15.一切皆对象

is,==:

对象引用:计数,删除

回收机制:gc

可变对象与不可变对象:参数

函数名就是引用:

 

posted @ 2020-09-13 11:17  Gaoyongxian666  阅读(105)  评论(0编辑  收藏  举报