- 博客(8)
- 收藏
- 关注
原创 Linux基本组和附加组的关系
基本组 :随用户创建的组 组名同用户名 显示在 /etc/passwod(查看) 一个用户只有一个基本组附加组:用户加入的组 /etc/group(查看) id命令也可以查看修改组-g 指定用户的基本组-G 指定用户的附加组...
2022-05-08 14:45:08
2468
2
原创 linux文件管理
文件管理/ 根ctrl+l 清屏cd /root/桌面 在桌面进行操作命令语法1.ls 列出目录2.cd 改变目录(进入目录) cd 绝对路径或相对路径 cd /home/alice 跳到所在路径(去往一个目录)******绝对路径 缺点 路径长 解决方法1. cd当前文件cd /aaa/bbb/ccc/ddd .为当前目录 touch ./ 8.txt ..为上一级目录 touch ../11.txt ls ...
2022-05-08 14:13:30
394
原创 集合的创建以及集合的删除和添加
1.集合的创建# 创建集合使用{}或者set(),但如果要创建空集合只能用ste() 因为{}用来创建字典# 集合元素不能重复# 集合有去重功能# 1.创建有数据的集合a1 = {1, 2, 3, 4, 5, 6}print(a1)print(type(a1))a2 = {10, 20, 20, 30}print(a2)print(type(a2))# 字典有无序性a3 = set('abcdefg')print(a3)print(type(a3))# 2.创建空集合只
2022-03-05 00:56:31
847
原创 字典的遍历
# 1.遍历字典keydict1 = {'age': 18, 'name': 'Tom', 'from': 'USA', 'hight': 180}for key in dict1.keys(): print(key) # 2. 遍历valuefor value in dict1.values(): print(value) # 3.遍历字典的元素 字典序列.items() 函数以列表返回可遍历的(键, 值) 元组数组。for item in dict1.i.
2022-03-05 00:51:06
108
原创 字典的修改和新增 和查找
1. 字典的修改和新增dict = {'age': 18, 'name': 'Tom', 'from': 'USA', 'hight': 180}# 如果key存在则修改key对应的值 如果不存在 则添加此键值对dict['hight'] = '170'print(dict)dict['年级'] = '实习'print(dict)2.字典的dict = {'age': 18, 'name': 'Tom', 'from': 'USA', 'hight': 180}# 1. [
2022-03-05 00:48:55
1078
原创 字典的基本内置函数使用与语法
# 字典特点# 1.符号为大括号 2.数据为键值对形式出现 3.各个键值对之间用逗号隔开dict = {'age':18 ,'name':'Tom','from':'USA'}print(dict)# len() 查字典长度print(len(dict))# copy 复制dict1 =dict.copy()print(dict1)# clear 删除字典内所有的元素dict.clear()print(dict)i = 1while i<9: x = 1 .
2022-03-05 00:44:00
154
原创 列表的遍历和嵌套
1.列表的遍历# 遍历:依次打印列表中各个数据# 1. while循环遍历list1 = ['1', '2', '5', '1', '1', 'e', 'w', 'e']i = 0 # 表示下标数据while i < len(list1): print(list1[i]) # 利用逐渐变大的下标打印 i += 1# 2.for循环遍历list2 = ['1', '2', '5', '1', '1', 'e', 'w', 'e']for i in list2:
2022-03-05 00:41:39
704
原创 列表的增删改查
1.查找列表的元素是否存在"""列表中是否存在 返回值True Falsein not in"""list = ['1', '3''5', '7']print('1' in list)print('8' in list)print('1' not in list)print('8' not in list)'''查找用户是否存在'''a = input('请输入你要查找的数字:')if a in list: print(f'请输入你的{a},已存在')els
2022-03-05 00:38:16
574
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人