![](https://img-blog.csdnimg.cn/2021040217085321.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
Python
基础语法笔记
super_m@n
长路漫漫,唯键作伴!
展开
-
vscode自定义快捷代码
打开软件->左下角设置->用户代码片段->选中对应的配置文件(比如我写python,就在python.json中配置){ // Place your snippets for python here. Each snippet is defined under a snippet name and has a prefix, body and // description. The prefix is what is used to trigger the snip原创 2021-04-03 08:58:38 · 621 阅读 · 0 评论 -
Fatal error in launcher: Unable to create process using
想用pip安装模块,执行的时候才发现pip和pip3都报错 检查环境变量,文件后缀都没有问题。 在网上搜了一下,有的小伙伴说执行python3 -m pip install --upgrade pip,不过我的报错了。 后来查了查应该先执行python3 -m pip install psycopg2在执行python3 -m pip install --upgrade pip就可以使用。记下来为了后面的同学少踩坑。啦啦啦 ...原创 2020-12-04 11:24:43 · 293 阅读 · 0 评论 -
Python中type和isinstance的使用和区别
1.type()的用法:用于判断一个未知对象的类型print(type(1)) # <class 'int'>print(type(1.1)) # <class 'float'>print(type(True)) # <class 'bool'>print(type(-10)) # <class 'int'>print(type('1.1')) # <class 'str'>print(type(0 + 0j)) .原创 2020-07-07 23:39:01 · 525 阅读 · 0 评论 -
Python笔记-面向对象
1.类的设计满足三要素三特性类名:驼峰命名法属性:有什么样的特征方法:有什么样的行为特性:封装 继承 多态2.内置函数以 __方法名__ 格式的方法是python的内置方法3.定义简单的类class 类名 : def 方法 (self ,参数列表) : pass定义类的时候self参数必须在第一位4.初始化方法_init_(self)5.内置方法__del__ : 把对象从内存中删除__str__ : 返回对象的描述信息,可以自定义返回信.原创 2020-06-22 20:19:36 · 407 阅读 · 0 评论 -
Python笔记-高级变量
1.列表name_list["aaa","bbb","ccc"]2.列表的方法增 name_list.append() name_list.insert() name_list.extend()删 name_list.remove() name_list.pop()查 print(name_list) print(name_list[0])改 name_list[1]=''3.列表的统计list_name.count('zhangsan')len(list_nam.原创 2020-06-22 20:17:55 · 237 阅读 · 0 评论 -
Python笔记之-函数基础
函数基础--------------------------------------------------------1.函数的定义def 函数名() : 代码块# 函数只封装代码,不主动调用不会输出2.函数的文档注释在函数体的下方用""" """的方式注释,pycharm中使用ctrl+Q 弹出窗口可以查看注释3.函数的参数def sum_num(sum1,sum2) :4.实参 形参定义函数的参数叫形参调用函数的参数叫实参5.函数的返回值 return让.原创 2020-06-22 20:16:33 · 183 阅读 · 0 评论 -
Python笔记之-基础概念
1.python中的编辑器类型CPython 用C语言实现的python解释器Jython 可以运行在java上的python解释器IronPython 可以运行在.net和Mone平台的解释器PyPy 用python实现的,支持JIT即时编译2.注释单行 # 注释内容多行 """ 注释内容 """3.运算符+ 加- 减* 乘/ 除// 取整除 返回除法的整数部分% 取余 返回除法的余数** 幂次方注意:*号可以计算字符串>>>".原创 2020-06-22 20:15:05 · 442 阅读 · 0 评论