随笔分类 - python汇总_字符串
摘要:textfsm # py from textfsm import TextFSM output = ''' N7K# show vlan VLAN Name Status Ports 1 default active Eth1/1, Eth1/2, Eth1/3 Eth1/5, Eth1/6, Et
阅读全文
摘要:基础知识 # 例子1 import numpy as np teams_list = ["Man Utd","Man City","T Hotspur"] data = np.array([[1, 2, 1], [0, 1, 0], [2, 4, 2]]) row_format ="{:>15}"
阅读全文
摘要:字符串切片汇总 [:-1]和[::-1] a='python' b=a[::-1] #nohtyp # 倒序 c=a[::-2] #nhy d=a[:-1] #从位置0到位置-1之前的数 #pytho e=a[:-2] #从位置0到位置-2之前的数 #pyth # 去掉后缀 name = file[
阅读全文
摘要:print # 打印进度 for i in range(30): print('\r%d'%i, end='', flush=True) time.sleep(1) # 机器学习打印环境 def update_env(L): while True: env_list = ['T']+ ['-'] *
阅读全文
摘要:带行的str转list str.splitlines([keepends])
阅读全文
摘要:file = 'testy.mp3' # 去掉后缀 # 1 name = file[:file.index('.mp3')] print(name) # 2 file_name = file.split('.') file_name = file_name[0] print(file_name) #
阅读全文
摘要:方法1. def get_all_news(self, response, file): rm_list = [ # r'</', # r'p>', # r'<', ] ret = response.xpath( '//p[not (img)][not (a)][position()>5] | //
阅读全文
浙公网安备 33010602011771号