Python第八课学习

Python第八课学习
www.cnblogs.com/resn/p/5800922.html
1 Ubuntu学习
根 /
/: 所有目录都在
/boot : boot配置文件,内核和其他

linux下 只有出错才会出现提示
. 当前目录
.. 上一级目录

cd 切换目录


www.cnblogs.com/resn/p/5776403.html

算数运算符 + - * / // % **
赋值运算符 = += -= *= /= //= **= %=

逻辑运算符: and or not
比较运算符: < > >= <= != ==

身份运算符: is is not type
成员运算符: in not in
面向对象

注释: # 单行注释
'...' 多行注释
"... " 多行注释


print
input
if
if...elif...else
while
for
continue
break

Python采用缩进形式以用来区分代码块
建议采用4个空格(常规上以tab代替),但一定不能tab与空格联合使用

num = 1
while num < 11:
break
print("Hello world")
num = num + 1

数值类型(整数 int ,浮点数 ,复数(a+bi))
字符串 str
布尔值 True False
列表 [*,*,*]
元组 [*,*,*] 只能查,不能改
字典 {*,* ,*} 以键值对存在,通过对键值的操作实现增删改查

作业:
9*9 乘法表
三级菜单

序列(sequence)是有序的队列

文件操作:
f=open("b.txt","r")
f.close()
读写
Read()
readline()
readlines()
write()

seek() 移动光标
tell() 反馈光标位置

with open() as f 将文件打开后,会自动关闭文件

原文地址:https://www.cnblogs.com/Skypeduty1225/p/8578315.html