2023年5月13日

python常用模块

摘要: OS模块 os.remove() 删除文件 os.unlink() 删除文件 os.rename() 重命名文件 os.listdir() 列出指定目录下所有文件 os.chdir() 改变当前工作目录 os.getcwd() 获取当前文件路径 os.mkdir() 新建目录 os.rmdir() 阅读全文

posted @ 2023-05-13 11:08 jun_li123 阅读(9) 评论(0) 推荐(0)

2023年4月21日

闭包 python

摘要: 一般,不能给外部作用域内的变量赋值,所以这里factor=factor+1会报错,需要在前面加上nonlocal 阅读全文

posted @ 2023-04-21 17:19 jun_li123 阅读(18) 评论(0) 推荐(0)

2022年10月4日

tr

摘要: [root@lijun ~]# [root@lijun ~]#echo {1..10} num.txt 1 2 3 4 5 6 7 8 9 10 num.txt [root@lijun ~]#echo {1..10} > num.txt [root@lijun ~]#cat num.txt 1 2 阅读全文

posted @ 2022-10-04 16:47 jun_li123 阅读(58) 评论(0) 推荐(0)

标准输出和错误

摘要: 两种实现方式 (1)&>file (2) >file 2>&1 阅读全文

posted @ 2022-10-04 15:39 jun_li123 阅读(20) 评论(0) 推荐(0)

2022年10月3日

rename

摘要: 1 [root@lijun ~]#ls 2 anaconda-ks.cfg创建0-9 10个文件 3 [root@lijun ~]#touch file{0..9}.conf 4 [root@lijun ~]#ls 5 anaconda-ks.cfg file0.conf file1.conf fi 阅读全文

posted @ 2022-10-03 17:11 jun_li123 阅读(104) 评论(0) 推荐(0)

PS1

摘要: 1 [root@liun ~]# PS1="\[\e[1;5;41;33m\][\u@\h \W]\\$\[\e[0m\]" 2 [root@liun ~]#PS1="\[\e[1;41;33m\][\u@\h \W]\\$\[\e[0m\]" 3 [root@liun ~]#PS1="\[\e[1 阅读全文

posted @ 2022-10-03 17:02 jun_li123 阅读(253) 评论(0) 推荐(0)

date

摘要: 1 [root@lijun ~]# date +%F 2 2022-10-03 3 [root@lijun ~]# date +"%F %T" 4 2022-10-03 16:52:38显示昨天的日期 5 [root@lijun ~]# date -d '-1 day' +%F 6 2022-10- 阅读全文

posted @ 2022-10-03 16:55 jun_li123 阅读(56) 评论(0) 推荐(0)

2021年12月15日

虚拟机网络ip消失,无法ping通

摘要: 物理机:win10 cmd ipconfig 虚拟机的问题: 解决方案: win10 服务开启标红的服务,再重启vmnet8和vmnet0,再去ipconfig 查看ip变成了192开头的了 阅读全文

posted @ 2021-12-15 11:29 jun_li123 阅读(91) 评论(0) 推荐(0)

2021年8月8日

永久路由

摘要: CentOS7添加永久静态路由 CentOS7永久静态路由需要写到 /etc/sysconfig/network-scripts/route-****** 文件中,故在/etc/sysconfig/network-scripts/下,新建文件名为route-*****的文件,(****代表网卡名)比 阅读全文

posted @ 2021-08-08 10:30 jun_li123 阅读(197) 评论(0) 推荐(0)

2021年7月19日

ip

摘要: 来自于iproute包,可用于代替ifconfig ip命令说明 OBJECT := { link | addr | route } ip link - network device configuration set dev IFACE,可设置属性:up and down:激活或禁用指定接口,相当 阅读全文

posted @ 2021-07-19 11:00 jun_li123 阅读(516) 评论(0) 推荐(0)

导航