摘要:
#文件读取path=r'D:\Python学习\day1\a.txt'f=open(path,encoding='utf-8')print(f)txt=f.read()print(txt)f.close()#文件写入# path=r'D:\Python学习\day1\a.txt'# f=open(p 阅读全文
摘要:
eventlist=[]def genEvent(): 'return event' event={} keys = ['时间','地点','事件'] for key in keys: msg = input(f'enter {key}') event.setdefault(key,msg) ret 阅读全文
摘要:
#列表解析+判断语句求偶数# print([i for i in range(1,101) if i %2==0])import randommath_report=[random.randint(0,100) for i in range(20)]chinese_report=[random.ra 阅读全文
摘要:
#1.统计小写英文字符出现的次数def countchrnum(s): result={} for c in s: if c < 'a' or c > 'z':# 判断字母c < a 或者 c >z continue if c in result: result[c] += 1 else: resu 阅读全文
摘要:
#字典详解d={'a':'98','b':'97'}a=dict(x=10,y=20) #创建对象b=((('x',90),'y',100))s1='abc's2='123'print(dict(zip(s1,s2)))print(dict.fromkeys(s1,-1))print(a,b)pri 阅读全文
摘要:
#冒泡排序list1=[3,2,4,1,5,0]#外部def bubblesort(l): for end in range(len(list1)-1): #内部两两交换位置 循环,len(list1)-end-1 for index in range(len(list1)-end-1): if l 阅读全文
摘要:
#列表切片操作l=list(range(10))print(l)A=sum(l)print(A)object=zip('123','345')for item in object: print(item)#1.插入元素list1=[]list1.append(1)list1.append('1')p 阅读全文
摘要:
#解析手机价格prices='荣耀v20:1899,xiaomiMax3:2599,vivoz5:1648'#函数接口 及返回值 不需要返回def parsePhonePrice(pricelist): step1=prices.split(',') #['荣耀v20:1899', 'xiaomiM 阅读全文
摘要:
#!/bin/sh#author: arrayusers="monitoring"passs="8121211210"sockets="/data/hgame_M/run/mysql.sock"OLD_IFS="$IFS"rf=$(mktemp)node_ip="hx_OL_hgame_M"log_ 阅读全文
摘要:
cat /etc/filebeat/filebeat.ymlfilebeat.inputs:- type: log paths: - /home/www/nangua/www/Runtime/Logs/*/* tags: ["jfm-admin-log"] close_timeout: 3h cle 阅读全文