class Pizza(object):
@staticmethod
def mix_ingredients(x, y):
return x + y
def cook(self):
一个圆盘,分成N块,有M种涂色方案,要求相邻两块不可同色,有多少种涂色方案。
A(N)可以看成第一块M种和剩下的M-1块又N-1种涂色方案,但是包含了第一块和最后一块同色的情况,即A(N-1) A(N) = M * (M-1)^N-1 - A(N-1)
import math
def vender(N, M): # N块, M种涂色方案
快排
- 第3行: 判断列表长度是否小于等于1, 如果小于等于1,直接返回列表
- 第4行:返回递归函数拼接的列表,[lt for lt in L[1:] if lt <= L[0]] 列表推导表达式,返回一个比 L[0] 小的列表,[ge for ge in L[1:] if ge >= L[0]], 返回一个比L[0] 大的列表, 再加上L[0] 就构成完整的列表
#coding:utf-8
def qsort(L):
if len(L) <= 1: return L
return qsort([lt for lt in L[1:] if lt < L[0]]) + L[0:1]+ \- 准备一个python脚本写入正态分布的数据
import mxnet as mx
from mxboard import SummaryWriter
with SummaryWriter(logdir='./logs') as sw:
for i in range(10):
# create a normal distribution with fixed mean and decreasing std
def _tf(self, word, count):
return count[word] / sum(count.values())
def _idf(self, word, count_list):
if word in self.idf_dict:
return self.idf_dict[word]
c_idf = sum(1 for q_id in count_list.keys() if word in count_list[q_id])
self.idf_dict[word] = math.log(len(count_list)) / (1 + c_idf)
return self.idf_dict[word]
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
| # Byte-compiled / optimized / DLL files | |
| __pycache__/ | |
| *.py[cod] | |
| # C extensions | |
| *.so | |
| # Distribution / packaging | |
| bin/ | |
| build/ |
重要设置
ResultSetMaxRows默认10000,影响返回结果
查看导入状态
select * from DB.DBA.load_list;
导入N3数据
linux下通过进程名查看其占用端口:
1、先查看进程pid
ps -ef | grep 进程名
2、通过pid查看占用端口
netstat -nap | grep 进程pid
linux通过端口查看进程: