This file contains hidden or 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
pip3 install -i https://mirrors.ustc.edu.cn/pypi/web/simple pyinstaller |
This file contains hidden or 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
root@ip-172-31-7-24:/web/hushanbin# docker system prune | |
WARNING! This will remove: | |
- all stopped containers | |
- all networks not used by at least one container | |
- all dangling images | |
- all build cache | |
Are you sure you want to continue? [y/N] N |
This file contains hidden or 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
docker inspect -f "{{.Name}} {{.Config.Cmd}}" $(docker ps -a -q) |
This file contains hidden or 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
# defaultdict Examples | |
# Using list as the default_factory, it is easy to group a sequence of key-value pairs into a dictionary of lists: | |
s = [('yellow', 1), ('blue', 2), ('yellow', 3), ('blue', 4), ('red', 1)] | |
d = defaultdict(list) | |
for k, v in s: | |
d[k].append(v) | |
sorted(d.items()) |
This file contains hidden or 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
import csv | |
row1 = [1,2,3,4,5] | |
row2 = [1,2,3,4,5] | |
row3 = [1,2,3,4,5] | |
rows = [row1,row2,row3] | |
with open(csv_name,"w") as csvfile: | |
writer = csv.writer(csvfile) | |
#先写入columns_name | |
writer.writerow(["bottom", "left", "right", "top", "value"]) |
This file contains hidden or 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
>>> string = 'hello world' | |
>>> { a:string.count(a) for a in set(string.replace(' ','')) } | |
{'h': 1, 'e': 1, 'w': 1, 'l': 3, 'o': 2, 'd': 1, 'r': 1} |
This file contains hidden or 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
# gitignore | |
.*.swp | |
*.idea | |
*.xls | |
*.txt | |
*.csv | |
*.xml | |
nohup.out | |
*.xls |
This file contains hidden or 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 -*- | |
import pip | |
from subprocess import call | |
for dist in pip.get_installed_distributions(): | |
call("pip install --upgrade " + dist.project_name, shell=True) |
This file contains hidden or 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
#!/usr/bin/env python3 | |
#encoding:utf-8 | |
import pandas as pd | |
import numpy as np | |
# 读取excel | |
df = pd.read_excel('m020171205.xlsx') | |
# 只保留第一项,并修改列名 | |
df_first = df.drop_duplicates(['借据号'],keep='first') |
This file contains hidden or 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
#!/usr/bin/env python | |
# encoding: utf-8 | |
import pandas as pd | |
import psycopg2 | |
conn_dv = psycopg2.connect(database="", user="", password="") | |
def read_csv(filename): | |
usr_list = pd.read_csv(filename) | |
res = [] |