Skip to content

Instantly share code, notes, and snippets.

View Everfighting's full-sized avatar
😁
I may be slow to respond.

蔡大锅 Everfighting

😁
I may be slow to respond.
View GitHub Profile
from itertools import groupby
sep = ',!?:; :,.。!?《》、|\\/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
eng_split_texts = [''.join(g) for k, g in groupby(self.eng_texts, sep.__contains__) if not k]
select col from yourtable
order by cast(col as unsigned)
from sys import platform
if platform == "linux" or platform == "linux2":
# linux
elif platform == "darwin":
# OS X
elif platform == "win32":
# Windows...
"""
将docx,doc文件转换成pdf的后缀,不考虑大小写
"""
import re
doc_format_list=[r'.docx',r'.doc']
doc_format_pattern='|'.join(doc_format_list)
path = r'C:\Users\Administrator\Desktop\temp\托书2 - Copy.DOCX'
print(re.sub(doc_format_pattern, r'.pdf', path, flags=re.I))
# 获取python解释器的位数
import struct
print(struct.calcsize("P") * 8)
from sklearn.datasets import load_iris
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split
import matplotlib.pyplot as plt
import numpy as np
# 加载数据集
iris = load_iris()
# 数据特征:150行, 4列
import matplotlib.pyplot as plt
import numpy as np
def sigmoid(x):
return 1. / (1. + np.exp(-x))
x = np.arange(-10, 10, 0.1)
y = sigmoid(x)
plt.plot(x, y)
@Everfighting
Everfighting / get_imports
Created September 20, 2019 02:41
找出所有仓库里面的python包
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
import os
import glob
# clone所有的仓库,如果仓库存在则更新
def clone_all_project():
import operator
x = {1: 2, 3: 4, 4: 3, 2: 1, 0: 0}
sorted_x = sorted(x.items(), key=operator.itemgetter(1))
import operator
x = {1: 2, 3: 4, 4: 3, 2: 1, 0: 0}
sorted_x = sorted(x.items(), key=operator.itemgetter(0))
x = {1: 2, 3: 4, 4: 3, 2: 1, 0: 0}