![](https://img-blog.csdnimg.cn/20190918140037908.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
花两万多买的Python教程全套_入门-精通
https://www.bilibili.com/video/BV1wD4y1o7AS?share_source=copy_web
橙黄橘绿时_Eden
在读硕士
展开
-
模块导入安装、编码格式、文件的读写、with语句、os模块、os.path模块
# -*- coding: utf-8 -*-# @Time : 2021/10/3 19:50# @Author : 李新宇# @FileName: demo1.py# @Software: PyCharmprint('你好,中国')# -*- coding: utf-8 -*-# @Time : 2021/10/3 20:07# @Author : 李新宇# @FileName: demo2.py# @Software: PyCharm# -*-原创 2021-10-04 10:51:30 · 102 阅读 · 0 评论 -
创建对象的过程、类的赋值与拷贝、模块化、包、第三方模块
# -*- coding: utf-8 -*-# @Time : 2021/10/3 18:19# @Author : 李新宇# @FileName: demo1.py# @Software: PyCharmdef fun(): passdef fun2(): passclass Student: native_place='吉林' #类属性 def eat(self,name,age): self.name=name原创 2021-10-03 19:46:34 · 67 阅读 · 0 评论 -
面向对象的三大特征:封装、继承、多态
# -*- coding: utf-8 -*-# @Time : 2021/10/3 15:11# @Author : 李新宇# @FileName: demo1.py# @Software: PyCharmclass Car: def __init__(self,brand): self.brand=brand def start(self): print('汽车已启动')car=Car('宝马x5')car.start()pr原创 2021-10-03 18:17:40 · 67 阅读 · 0 评论 -
类与对象_
# -*- coding: utf-8 -*-# @Time : 2021/10/3 11:15# @Author : 李新宇# @FileName: demo1.py# @Software: PyCharm'''编程的两大思想:面对过程和面向对象''''''类与对象''''''创建类'''class Student: #Student为类名,由一个或多个单词组成,规范:每个单词的首字母大写,其余小写。 pass#Python中国一切皆对象Student是对象吗原创 2021-10-03 13:25:42 · 66 阅读 · 0 评论 -
Bug__
# -*- coding: utf-8 -*-# @Time : 2021/9/30 21:12# @Author : 李新宇# @FileName: demo1.py# @Software: PyCharmage=input('请输入你的年龄:')print(type(age))if int(age)>=18: print('成年人')i=0while i < 10: print(i) i += 1# -*- coding: utf原创 2021-09-30 22:52:16 · 67 阅读 · 0 评论 -
函数___
# -*- coding: utf-8 -*-# @Time : 2021/9/27 21:40# @Author : 李新宇# @FileName: demo1.py# @Software: PyCharm#函数的定义与调用def calc(a,b): #a,b称为形式参数,简称形参,形参的位置是在函数的定义处 c=a+b return cresult=calc(10,20) #10,20称为实参值,实际参数的值,实参的位置是函数的调用处, 位置参数prin原创 2021-09-28 21:14:27 · 71 阅读 · 0 评论 -
字符串__
# -*- coding: utf-8 -*-# @Time : 2021/9/27 15:54# @Author : 李新宇# @FileName: demo1.py# @Software: PyCharm'''字符串的驻留机制'''a='python'b="python"c='''python'''print(a,id(a))print(b,id(b))print(c,id(c))# -*- coding: utf-8 -*-# @Time : 202原创 2021-09-27 18:44:45 · 51 阅读 · 0 评论 -
元组、集合
# -*- coding: utf-8 -*-# @Time : 2021/9/27 14:25# @Author : 李新宇# @FileName: demo1.py# @Software: PyCharm'''可变序列 列表 字典'''lst=[10,20,30]print(id(lst))lst.append(40)print(id(lst))'''不可变序列,字符串,元组'''s='hello'print(id(s))s=s+'world'print(id.原创 2021-09-27 15:51:42 · 63 阅读 · 0 评论 -
字典_____
# -*- coding: utf-8 -*-# @Time : 2021/9/27 10:31# @Author : 李新宇# @FileName: demo1.py# @Software: PyCharm'''字典的创建方式''''''使用{}创建字典'''scores={'张三':100,'李四':20,'王五':30}print(scores)'''第二种创建dict()'''student=dict(name='Eden',age=20)print(studen原创 2021-09-27 11:30:24 · 50 阅读 · 0 评论 -
列表list
# -*- coding: utf-8 -*-# @Time : 2021/9/26 19:23# @Author : 李新宇# @FileName: demo1.py# @Software: PyCharma=10 #变量引用的是一个1对象的引用lst=['hello','world',98]print(id(lst))print(type(lst))print(lst)# -*- coding: utf-8 -*-# @Time : 2021/9/26 20:1原创 2021-09-27 10:31:07 · 81 阅读 · 0 评论 -
range、while、for_in、break、continue、else
# -*- coding: utf-8 -*-# @Time : 2021/9/26 15:04# @Author : 李新宇# @FileName: demo1.py# @Software: PyCharm#range()的三种创建方式'''第一种创建方式,只有一个参数(小括号中只给了一个数)'''r=range(10) #[0, 1, 2, 3, 4, 5, 6, 7, 8, 9],默认从零开始,默认步长为1print(r) #range(0, 10)print(list(r原创 2021-09-26 19:03:03 · 121 阅读 · 0 评论 -
组织结构、布尔值、分支结构、条件表达式、pass语句
# -*- coding: utf-8 -*-# @Time : 2021/9/25 16:57# @Author : 李新宇# @FileName: demo1.py# @Software: PyCharm'''把大象装冰箱需要几步'''print('---程序开始--')print('打开冰箱门')print('把大象放进冰箱')print('把冰箱门关上')print('---程序结束--')# -*- coding: utf-8 -*-# @Time : 2原创 2021-09-25 19:52:44 · 85 阅读 · 0 评论 -
运算符__
# -*- coding: utf-8 -*-# @Time : 2021/9/25 11:24# @Author : 李新宇# @FileName: demo1.py# @Software: PyCharm#输入函数inputpresent=input('你想要什么礼物呢?')print(present,type(present))# -*- coding: utf-8 -*-# @Time : 2021/9/25 11:28# @Author : 李新宇# @原创 2021-09-25 16:52:20 · 80 阅读 · 0 评论 -
input函数的使用
# -*- coding: utf-8 -*-# @Time : 2021/9/25 11:24# @Author : 李新宇# @FileName: demo1.py# @Software: PyCharm#输入函数inputpresent=input('哥哥想要什么礼物呢?')print(present,type(present))# -*- coding: utf-8 -*-# @Time : 2021/9/25 11:28# @Author : 李新宇#原创 2021-09-25 11:37:47 · 355 阅读 · 0 评论 -
二进制与字符编码、变量的多次赋值、数据类型、数据类型转换
# -*- coding: utf-8 -*-# @Time : 2021/9/25 9:27# @Author : 李新宇# @FileName: demo3.py# @Software: PyCharm#二进制与字符编码# print(chr(0b100111001011000)) #chr:转换成字符# print(ord('乘')) #输出转成成十进制#python中的标识符和保留字,保留字是pytho规定的,不能随意做文件名,标识符是自己定义的#变量的定义和使原创 2021-09-25 11:18:54 · 128 阅读 · 0 评论 -
转义字符与原字符
# -*- coding: utf-8 -*-# @Time : 2021/9/25 8:01# @Author : 李新宇# @FileName: demo2.py# @Software: PyCharm#转义字符print('hello\nworld') #\加上转移功能的首字符 n---newline的首字母print('hello\tworld') # Tab,水平制表符,四个字符一个单元/制表位print('helloooo\tworld') # 1tab=1~4sp原创 2021-09-25 08:35:40 · 160 阅读 · 0 评论 -
输出函数print
# -*- coding: utf-8 -*-# @Time : 2021/9/25 7:41# @Author : 李新宇# @FileName: first.py# @Software: PyCharm# print("hello,world")#5.输出函数print,输出到控制台或者文件当中#可以输出数字print(53)#可以输出字符串print("hello,wolrd")print('hello,world')#含有运算符的表达式print(3+1)原创 2021-09-25 08:35:02 · 74 阅读 · 0 评论