- 博客(17)
- 收藏
- 关注
原创 celery处理端报错
celery处理端报错可能是未进行运行前环境初始化但celery可能依赖某些django里的库或数据可以在处理端创基Celery()前加import osimport djangoos.environ.setdefault('DJANGO_SETTINGS_MODULE','项目名称.settings')django.setup()来进行环境初始化...
2022-05-08 11:42:38
361
原创 导入reverse时报错
ModuleNotFoundError: No module named 'django.core.urlresolvers'django较新版本导入reverse为from django.urls import reverse
2022-04-28 13:06:34
892
原创 Django富文本编辑器无法运行
404错误"GET /static/tinymce/themes/advanced/theme.min.js HTTP/1.1" 404可能是因为settings里的配置错误导致TINYMCE_DEFAULT_CONFIG = { 'theme': 'advance', 'width': 600, 'height': 400}将theme对应值改为silver此处错误可能是由tinymce不同版本导致...
2022-04-27 20:54:55
1106
原创 在字符串中找出连续最长的数字串
输入:abcd12345ed125ss123058789a8a72a6a5yy98y65ee1r2输出:123058789,9729865,2说明:样例一最长的数字子串为123058789,长度为9样例二最长的数字子串有72,98,65,长度都为2 while True: try: strl= input() import re a = re.findall(r"[0-9]+", strl) t
2022-04-04 14:28:42
430
原创 递归实现数字查找
import mathdef fun(loca,li): if len(tempa)== num: #递归终止条件 return tempa else: x = len(li) a = math.factorial(x) #计算排序个数,为x阶乘 b = loca%int(a/x) #计算下一次递归查找位置 if b == 0: temp = int(loca/(a.
2022-03-30 08:38:43
254
原创 整数与IP地址间的转换Python
data = input().split(".") #IP地址转整数a = []b = ''caozuo = [a.append(bin(int(i))[2:].rjust(8,"0")) for i in data]for i in a: b += iac = int(b,2)print(ac)data1 = bin(int(input()))[2:].rjust(32,"0") #整数转IP地址temp = []caozuo = [temp.append(int(data.
2022-03-28 18:19:54
5300
原创 删除字符串中出现次数最少的字符Python
temp = input()data = []ace = []for i in temp: if i in data: ace[data.index(i)] += 1 else: data.append(i) ace.append(1)p = min(ace)for i in temp: if ace[data.index(i)] != p: print(i,end="") else: .
2022-03-27 12:22:41
751
原创 坐标移动Python
A:向左移动,D:向右移动,W:向上移动,S:向下移动。从(0,0)点开始移动,输入:合法坐标为A(或者D或者W或者S)+数字(两位以内)非法坐标点需要进行丢弃。如AA10;A1A;$%$;YAD;等。flag = input().split(";")for item in flag: if item == "": flag.remove(item)start = [0,0]for item in flag: if item == Non...
2022-03-26 21:31:48
2135
原创 实现表记录合并Python
num = int(input())data = []for i in range(num): a ,b = input().split() a,b = int(a),int(b) data.append([a,b])for i in range(num): j = i+1 while j<len(data): if data[i][0] == data[j][0]: data[i][1] += data[j][1.
2022-03-26 16:10:37
440
原创 二叉树层序遍历Python实现
class TreeNode: def __init__(self,val): self.val = val self.lchild = None self.rchild = Nonedef FloorOrder(root): su = [] su.append(root) for item in su: if item.lchild: su.append(item.lchild) .
2022-03-25 13:08:30
1319
原创 滑动窗口和最大值计算Python
def Solution(N, li, M): rear = 0 # 尾 front = int(rear) + int(M) - 1 # 头 su = [] for i in range(N): sum = 0 if front <= N - 1: for j in range(front): sum += li[j] su.append(sum) .
2022-03-25 11:14:55
609
原创 字符串压缩Python实现
def pressandun(str1): strlist = [] templist = [] for i in str1: strlist.append(i) for i in range(len(strlist)): temp = 1 if strlist[i] == strlist[i-1] and i != 0: continue else: templ.
2022-03-24 20:11:06
498
原创 解密犯罪事件Python实现
def Solution(tim): tim = list(tim.replace(":","")) time = list((int(i) for i in tim)) if time[3] > time[2] and time[3] < 6: time[2] = time[3] time = list((str(i) for i in time)) time.insert(2, ":") time = .
2022-03-24 19:21:54
530
原创 N进制减法Python实现
Python实现2—10进制自由转换减法def Nsubtraction(n, a1, a2): n1 = list(int(a) for a in str(a1)) n1 = n1[::-1] n2 = list(int(a) for a in str(a2)) n2 = n2[::-1] n3 = list("" for _ in range(max(len(n1),len(n2)))) for i in n1: if i <
2022-03-24 18:00:11
1237
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人