因?yàn)橛袝r(shí)區(qū),mktime是本地時(shí)區(qū)
https://docs.python.org/3/lib...
>>> int(time.mktime(time.strptime('2018-03-08 00:00:00', "%Y-%m-%d %H:%M:%S")))
1520438400 # 北京時(shí)間
>>> time.tzname
('CST', 'CST')
>>> time.timezone
-28800 # 8小時(shí)
from datetime import datetime
datetime.now().strftime('%Y-%m-%d 23:59:00')使用裝飾器
def decorator(func):
def wrapper(*args, **kw):
data = args[0],
dependencies = kw["dependencies"]
# Write your code here
return func(data, dependencies=dependencies)
return wrapper
@decorator
def calc(data, dependencies=["price","vol"]):
passimport numpy as np
def num(i=[0]):
i[0] += 1
return i[0]
shu_ru = int(input("shu ru "))
a = np.zeros((shu_ru, shu_ru))
k = 1
all = []
while k < shu_ru * 2:
lst = []
for i in range(k):
for j in range(k):
if i + j == k - 1 and i < shu_ru and j < shu_ru:
lst.append((i, j))
if k % 2 == 0:
lst.reverse()
k += 1
all.append(lst_p)
for i in all:
for j in i:
a[j] = num()
當(dāng)a = 3,輸出
Out[1]:
array([[1., 3., 4.],
[2., 5., 8.],
[6., 7., 9.]])
當(dāng)a = 4,輸出
Out[2]:
array([[ 1., 3., 4., 10.],
[ 2., 5., 9., 11.],
[ 6., 8., 12., 15.],
[ 7., 13., 14., 16.]])
當(dāng)a = 1,輸出
Out[2]: array([[1.]])
代碼寫的比較直白,沒有優(yōu)化,大概就是從下標(biāo)跟你的輸入值的關(guān)系著手分析。
cookies取值不需要通過正則,你直接使用索引就行了
比如你的cookies取tk值
self.s.cookies['tk']為何不用官方編譯好的軟件包?安裝完自帶service腳本,省時(shí)省力,干嘛要自己編譯?
多少時(shí)間不算慢?
可以看下 https://docs.opencv.org/2.4/d... 特征提取找映射的方法。
這樣即使圖片有縮放和輕度旋轉(zhuǎn)一樣能搞定。
遍歷的話,考慮下GPU加速。沒有GPU的話也可進(jìn)行多線程等優(yōu)化。
brew tap kyslik/php
brew install phpXX-mongodb
我是php7.1版本,所以命令是 brew install php71-mongodb
SubTurnExport 在http://piccache.cnki.net/kdn/... 里,在你獲取的js里搜索就行了
可以使用默認(rèn)值,如果取不到就是空l(shuí)ist,不會(huì)進(jìn)入循環(huán)
images = item.get('image_list', [])找到了,toFixed()會(huì)自動(dòng)四舍五入...
如果在print下方加上return的話
你有兩個(gè) print ,在第8行的下方加一個(gè) return 沒有任何額外作用。在第10行下文加一個(gè) return 是語(yǔ)法錯(cuò)誤。
所以,不知道你想問什么。
找到相關(guān)的源碼了,雖然看不懂:
static PyObject *
gen_send_ex(PyGenObject *gen, PyObject *arg, int exc, int closing)
{
PyThreadState *tstate = PyThreadState_GET();
PyFrameObject *f = gen->gi_frame;
PyObject *result;
if (gen->gi_running) {
const char *msg = "generator already executing";
if (PyCoro_CheckExact(gen)) {
msg = "coroutine already executing";
}
else if (PyAsyncGen_CheckExact(gen)) {
msg = "async generator already executing";
}
PyErr_SetString(PyExc_ValueError, msg);
return NULL;
}
if (f == NULL || f->f_stacktop == NULL) {
if (PyCoro_CheckExact(gen) && !closing) {
/* `gen` is an exhausted coroutine: raise an error,
except when called from gen_close(), which should
always be a silent method. */
PyErr_SetString(
PyExc_RuntimeError,
"cannot reuse already awaited coroutine");
}
else if (arg && !exc) {
/* `gen` is an exhausted generator:
only set exception if called from send(). */
if (PyAsyncGen_CheckExact(gen)) {
PyErr_SetNone(PyExc_StopAsyncIteration);
}
else {
PyErr_SetNone(PyExc_StopIteration);
}
}
return NULL;
}
if (f->f_lasti == -1) {
if (arg && arg != Py_None) {
const char *msg = "can't send non-None value to a "
"just-started generator";
if (PyCoro_CheckExact(gen)) {
msg = NON_INIT_CORO_MSG;
}
else if (PyAsyncGen_CheckExact(gen)) {
msg = "can't send non-None value to a "
"just-started async generator";
}
PyErr_SetString(PyExc_TypeError, msg);
return NULL;
}
} else {
/* Push arg onto the frame's value stack */
result = arg ? arg : Py_None;
Py_INCREF(result);
*(f->f_stacktop++) = result;
}
/* Generators always return to their most recent caller, not
* necessarily their creator. */
Py_XINCREF(tstate->frame);
assert(f->f_back == NULL);
f->f_back = tstate->frame;
gen->gi_running = 1;
gen->gi_exc_state.previous_item = tstate->exc_info;
tstate->exc_info = &gen->gi_exc_state;
result = PyEval_EvalFrameEx(f, exc);
tstate->exc_info = gen->gi_exc_state.previous_item;
gen->gi_exc_state.previous_item = NULL;
gen->gi_running = 0;
/* Don't keep the reference to f_back any longer than necessary. It
* may keep a chain of frames alive or it could create a reference
* cycle. */
assert(f->f_back == tstate->frame);
Py_CLEAR(f->f_back);
/* If the generator just returned (as opposed to yielding), signal
* that the generator is exhausted. */
if (result && f->f_stacktop == NULL) {
if (result == Py_None) {
/* Delay exception instantiation if we can */
if (PyAsyncGen_CheckExact(gen)) {
PyErr_SetNone(PyExc_StopAsyncIteration);
}
else {
PyErr_SetNone(PyExc_StopIteration);
}
}
else {
/* Async generators cannot return anything but None */
assert(!PyAsyncGen_CheckExact(gen));
_PyGen_SetStopIterationValue(result);
}
Py_CLEAR(result);
}
else if (!result && PyErr_ExceptionMatches(PyExc_StopIteration)) {
const char *msg = "generator raised StopIteration";
if (PyCoro_CheckExact(gen)) {
msg = "coroutine raised StopIteration";
}
else if PyAsyncGen_CheckExact(gen) {
msg = "async generator raised StopIteration";
}
_PyErr_FormatFromCause(PyExc_RuntimeError, "%s", msg);
}
else if (!result && PyAsyncGen_CheckExact(gen) &&
PyErr_ExceptionMatches(PyExc_StopAsyncIteration))
{
/* code in `gen` raised a StopAsyncIteration error:
raise a RuntimeError.
*/
const char *msg = "async generator raised StopAsyncIteration";
_PyErr_FormatFromCause(PyExc_RuntimeError, "%s", msg);
}
if (!result || f->f_stacktop == NULL) {
/* generator can't be rerun, so release the frame */
/* first clean reference cycle through stored exception traceback */
exc_state_clear(&gen->gi_exc_state);
gen->gi_frame->f_gen = NULL;
gen->gi_frame = NULL;
Py_DECREF(f);
}
return result;
}df = df.replace(regex={'^="': '', '"$': ''})
跟你的js一致的
df.replace(r'="(.*)"', '\g<1>', regex=True)這個(gè)是動(dòng)態(tài)加載的,使用rest api,
使用瀏覽器調(diào)用這個(gè)
https://yuba.douyu.com/allclassify/anchorlist/list/516
就已經(jīng)調(diào)用二次動(dòng)態(tài)rest api
import requests
r = requests.get('https://yuba.douyu.com/wbapi/web/groupRecom/anchor?fid=516&page=1&pagesize=30×tamp=0.09703142416533206')
print(r.json())
在中間網(wǎng)站我請(qǐng)求兩次,第一次通過 GET 方式請(qǐng)求這個(gè)表單頁(yè)面從而獲取 token,第二次帶上這個(gè) token 發(fā)起 POST 請(qǐng)求,這樣不就成功偽裝了嗎?我這個(gè)想法應(yīng)該有問題,但好像又可以,錯(cuò)在哪?
中間網(wǎng)站是什么?
如果是指中間人攻擊,那么,你應(yīng)該關(guān)注的是 HTTPS。CSRF 不處理中間人攻擊。
如果是指第三方網(wǎng)站,那么,除非你的網(wǎng)站通過 Access-Control-Allow-Origin 頭允許,否則第三方網(wǎng)站無(wú)法讀取請(qǐng)求返回的內(nèi)容(跟其它一些跨域請(qǐng)求的處理一樣,能請(qǐng)求,但是未經(jīng)允許不得訪問),也就拿不到 token。
PS: 這么基礎(chǔ)的問題,那么多回答,竟然只有一個(gè)稍微靠譜點(diǎn)的…………
官方文檔:Apple Documentation on copying collections
根據(jù)文檔說明,深度拷貝有幾種
比較便捷的方法拷貝數(shù)組,使用initWithArray:copyItems:方法,將copyItems設(shè)置為YES
NSArray *deepCopyArray=[[NSArray alloc] initWithArray:array copyItems:YES];
使用NSKeyedArchiver進(jìn)行歸檔,然后解檔,深度拷貝一份
NSArray *trueDeepCopyArray = [NSKeyedUnarchiver unarchiveObjectWithData:
[NSKeyedArchiver archivedDataWithRootObject:oldArray]];
試試這樣:
df = pd.read_table('file.txt', sep='[ |\t]', encoding='utf-8', engine='python')
sep='[ |t]'表示用空格或tab做分隔符。
你說的沒有錯(cuò),確實(shí)安裝云鎖的問題,之前我找了很多答案,都不對(duì)
北大青鳥APTECH成立于1999年。依托北京大學(xué)優(yōu)質(zhì)雄厚的教育資源和背景,秉承“教育改變生活”的發(fā)展理念,致力于培養(yǎng)中國(guó)IT技能型緊缺人才,是大數(shù)據(jù)專業(yè)的國(guó)家
達(dá)內(nèi)教育集團(tuán)成立于2002年,是一家由留學(xué)海歸創(chuàng)辦的高端職業(yè)教育培訓(xùn)機(jī)構(gòu),是中國(guó)一站式人才培養(yǎng)平臺(tái)、一站式人才輸送平臺(tái)。2014年4月3日在美國(guó)成功上市,融資1
北大課工場(chǎng)是北京大學(xué)校辦產(chǎn)業(yè)為響應(yīng)國(guó)家深化產(chǎn)教融合/校企合作的政策,積極推進(jìn)“中國(guó)制造2025”,實(shí)現(xiàn)中華民族偉大復(fù)興的升級(jí)產(chǎn)業(yè)鏈。利用北京大學(xué)優(yōu)質(zhì)教育資源及背
博為峰,中國(guó)職業(yè)人才培訓(xùn)領(lǐng)域的先行者
曾工作于聯(lián)想擔(dān)任系統(tǒng)開發(fā)工程師,曾在博彥科技股份有限公司擔(dān)任項(xiàng)目經(jīng)理從事移動(dòng)互聯(lián)網(wǎng)管理及研發(fā)工作,曾創(chuàng)辦藍(lán)懿科技有限責(zé)任公司從事總經(jīng)理職務(wù)負(fù)責(zé)iOS教學(xué)及管理工作。
浪潮集團(tuán)項(xiàng)目經(jīng)理。精通Java與.NET 技術(shù), 熟練的跨平臺(tái)面向?qū)ο箝_發(fā)經(jīng)驗(yàn),技術(shù)功底深厚。 授課風(fēng)格 授課風(fēng)格清新自然、條理清晰、主次分明、重點(diǎn)難點(diǎn)突出、引人入勝。
精通HTML5和CSS3;Javascript及主流js庫(kù),具有快速界面開發(fā)的能力,對(duì)瀏覽器兼容性、前端性能優(yōu)化等有深入理解。精通網(wǎng)頁(yè)制作和網(wǎng)頁(yè)游戲開發(fā)。
具有10 年的Java 企業(yè)應(yīng)用開發(fā)經(jīng)驗(yàn)。曾經(jīng)歷任德國(guó)Software AG 技術(shù)顧問,美國(guó)Dachieve 系統(tǒng)架構(gòu)師,美國(guó)AngelEngineers Inc. 系統(tǒng)架構(gòu)師。