1、测试1 [root@centos7 test2]# ls a.txt [root@centos7 test2]# if [ -e a.txt ]; then echo "exist";else echo "no nxist"; fi exist [root@centos7 test2]# if ...
分类:
系统相关 时间:
2021-04-23 11:53:02
阅读次数:
0
#!/usr/bin/env python # -*- coding:utf-8 -*- # <editable> def execute(): # <editable> ''' 载入模块 ''' from collections import Counter import pandas as pd ...
分类:
编程语言 时间:
2021-04-23 11:49:29
阅读次数:
0
str 用合理的方式转换为字符串 print(str("hello,\nworld!")) 'hello, world!' repr 用合法的python表达式表示 print(repr("hello,\nworld!"))'hello,\nworld!' 长字符串 要表示很长的字符串可以用三引号( ...
分类:
编程语言 时间:
2021-04-22 16:36:02
阅读次数:
0
2.2.1名字错误 名字错误:python 的关键字写错了。 NameError: name 'python3' is not defined 现象: 2.2.2语法错误 SyntaxError: invalid syntax 无效的语法:Java 和 JS 一行结束用分号“;”Python 用的换 ...
分类:
编程语言 时间:
2021-04-22 16:31:44
阅读次数:
0
linux shell脚本中流程控制语句 if、for、while、case 1、if语句 [root@centos7 test2]# ls test.sh [root@centos7 test2]# pwd /home/test2 [root@centos7 test2]# cat test.sh ...
分类:
系统相关 时间:
2021-04-22 16:20:40
阅读次数:
0
Shell工具 cut:可以切割提取指定列\字符\字节的数据 cut可以将文本按列进行划分的文本处理,cut命令逐行度入文本,然后按列划分字段并进行提取,输出等操作 选项参数: -f 提取范围 列号,获取第几列 -d 自定义分隔符 自定义分隔符,默认为制表符 -c 提取范围 以字符为单位进行分割 - ...
分类:
系统相关 时间:
2021-04-22 16:20:19
阅读次数:
0
#!/usr/bin/env python #-*- coding:utf-8 -*- num=0 while num<=10: print(num,end="\t") num +=1 print("**************************") num2=0 sum_all=0 whil ...
分类:
其他好文 时间:
2021-04-22 16:16:24
阅读次数:
0
1 """ 2 协程:实现多任务的另一种方式; 3 单线程的并发,又称微线程; 4 一种用户态的轻量级线程 5 6 特性: 7 对于协程来说,程序员就是上帝,你想让她执行到哪里,他就执行到哪里--实现任务的任意切换 8 原理:能够保留上一次调用的状态(生成器也有这个功能) 9 意义:线程间切换需耗时 ...
分类:
编程语言 时间:
2021-04-22 16:15:42
阅读次数:
0
一、什么是unittest unittest是Python单元测试框架,类似于JUnit框架。 unittest中有4个重要的概念:test fixture, test case, test suite, test runner Testcase: 一个TestCase的实例就是一个测试用例。什么是 ...
分类:
其他好文 时间:
2021-04-22 16:10:25
阅读次数:
0
上班想摸鱼?为了摸鱼方便,今天自己写了个爬取笔阁小说的程序。好吧,其实就是找个目的学习python,分享一下。 1. 首先导入相关的模块 import os import requests from bs4 import BeautifulSoup 2. 向网站发送请求并获取网站数据 网站链接最后的 ...
分类:
编程语言 时间:
2021-04-22 16:03:13
阅读次数:
0