摘要: eventlist=[]def genEvent(): 'return event' event={} keys = ['时间','地点','事件'] for key in keys: msg = input(f'enter {key}') event.setdefault(key,msg) ret 阅读全文
posted @ 2022-05-23 01:45 人生信条~~ 阅读(25) 评论(0) 推荐(0) 编辑
摘要: #列表解析+判断语句求偶数# 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 阅读全文
posted @ 2022-05-22 23:41 人生信条~~ 阅读(33) 评论(0) 推荐(0) 编辑
摘要: #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 阅读全文
posted @ 2022-05-22 19:11 人生信条~~ 阅读(152) 评论(0) 推荐(0) 编辑
摘要: #字典详解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 阅读全文
posted @ 2022-05-22 17:19 人生信条~~ 阅读(22) 评论(0) 推荐(0) 编辑
摘要: #冒泡排序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 阅读全文
posted @ 2022-05-22 15:29 人生信条~~ 阅读(18) 评论(0) 推荐(0) 编辑
摘要: #列表切片操作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 阅读全文
posted @ 2022-05-13 19:02 人生信条~~ 阅读(24) 评论(0) 推荐(0) 编辑
摘要: #解析手机价格prices='荣耀v20:1899,xiaomiMax3:2599,vivoz5:1648'#函数接口 及返回值 不需要返回def parsePhonePrice(pricelist): step1=prices.split(',') #['荣耀v20:1899', 'xiaomiM 阅读全文
posted @ 2022-05-09 15:41 人生信条~~ 阅读(16) 评论(0) 推荐(0) 编辑
摘要: #!/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_ 阅读全文
posted @ 2022-04-27 00:57 人生信条~~ 阅读(65) 评论(0) 推荐(0) 编辑
摘要: cat /etc/filebeat/filebeat.ymlfilebeat.inputs:- type: log paths: - /home/www/nangua/www/Runtime/Logs/*/* tags: ["jfm-admin-log"] close_timeout: 3h cle 阅读全文
posted @ 2022-04-24 22:02 人生信条~~ 阅读(89) 评论(0) 推荐(0) 编辑
摘要: #!/usr/local/python3/bin/python3 import sys import os import logging import datetime import pymysql from colorama import init, Fore, Back, Style from 阅读全文
posted @ 2022-04-24 21:43 人生信条~~ 阅读(132) 评论(0) 推荐(0) 编辑