This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.utils.deprecation import MiddlewareMixin | |
from django.contrib import messages | |
from django.utils import timezone | |
from django.conf import settings | |
from django.utils.functional import cached_property | |
class StateMiddleware(MiddlewareMixin): | |
@classmethod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> hello = 'Hello' | |
>>> world = 'world!' | |
>>> str = '{hello} {world}' | |
>>> str.format(**locals()) | |
# or | |
>>> str = '{hello.upper()} {world.upper()}' | |
>>> eval(f'''f"{str}"''') | |
'HELLO WORLD!' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
''' | |
File Name: parser.py | |
Author: JackeyGao | |
mail: gaojunqi@outlook.com | |
''' | |
import sys | |
import random | |
import time | |
import requests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
KEYS = { | |
"1": "id", | |
"2": "name", | |
"3": "class", | |
"4": "score", | |
} | |
def dict_to_sqlstring(d): | |
string = "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with open('del.sql', 'r') as f: | |
insert = "" | |
for i in f.readlines(): | |
if i.startswith('### DELETE FROM'): | |
insert = insert.strip(',') + ';' | |
if insert != ';': | |
print insert | |
insert = "INSERT INTO" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
''' | |
File Name: client.py | |
Author: JackeyGao | |
mail: gaojunqi@outlook.com | |
Created Time: 三 8/10 10:35:02 2016 | |
''' | |
import json | |
import sys | |
from collections import defaultdict |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"A": { | |
"AA": { | |
"AAA": "Hello" | |
} | |
}, | |
"B": { | |
"BB": { | |
"BBB": "world" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_args(request, excludes): | |
args = {} | |
for i in request.GET: | |
if i in excludes: | |
continue | |
value = request.GET.getlist(i) | |
if len(value) == 1: | |
args[i] = value[0] | |
else: | |
args[i] = value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 编码: 万国码-八 -*- | |
导入 系统 | |
定义 输出: | |
系统.标准输出.写入("你好, 世界!") | |
如果 __模块名__ == '__主体__': | |
输出() |