審核時間好長?。。?!
搜索一圈沒找到解決。臨時解決方法傳入父節(jié)點(diǎn),遞歸每層深度的父節(jié)點(diǎn)是一樣的
def get_code(self, node, parent=None, active=False):
if parent is None:
parent = node.getparent()
c = ''
if isinstance(node, etree._ElementUnicodeResult):
c = str(node).replace('\n', '').replace(' ', '').strip()
p = parent
print(p.tag + ' : ' + str(p.attrib) +' | content: '+ c)
return c
if isinstance(node, etree._Element):
for item in node.xpath('node()'):
c += str(get_code(item,node,active=active))
return cre.compile(r"select.*?from.*?where.*?;", re.S|re.M)?
可以用itertools.groupby,參考下這篇文章:https://segmentfault.com/a/11...
from itertools import groupby
d = {
'q_1': 9, 'q_2': 12, 'q3': 22, 'q4': 2, 'q5': 6,
'w_1': 9, 'w_2': 12, 'w_3': 22, 'w_4': 2, 'w_5': 6,
'e_1': 9, 'e_2': 12, 'e_3': 22, 'e_4': 2, 'e_5': 6,
'r_1': 9, 'r_2': 12, 'r_3': 22, 'r_4': 2, 'r_5': 6
}
new_dict = dict()
items = sorted(d.items())
for key, group in groupby(items, key=lambda x: x[0][0]):
new_dict[key] = dict(group)
print(new_dict)step為負(fù)數(shù)時,應(yīng)該是start 大于 end,
其他的理解的都對。
https://stackoverflow.com/que...
直接用Pip install ansible裝最新版不成功,但是裝上ansble 2.2.3版本就OK了,奇怪啊
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
import numpy as np
fig = plt.figure()
ax = fig.gca(projection='3d')
# Make the grid
x, y, z = np.meshgrid(np.array([1]),
np.array([1]),
np.array([1]))
# Make the direction data for the arrows
u = np.array([1, 0, 0])
v = np.array([0, 1, 0])
w = np.array([0, 0, 1])
ax.quiver(x, y, z, u, v, w, length=0.1, normalize=True)
plt.show()
登錄接口里不需要參數(shù)signature。
密碼是md5加密的。
"""
g = 'veenike';
c.isValidate && (c.password = md5(c.password), c.password = md5(g + c.password + g)
"""
先對你輸入的密碼md5加密,得到的字符串首尾再增加個veenike,得到的新字符串再md5。
搜索建議結(jié)果是用js動態(tài)生成的.
可以直接觀察它是向哪個 api 請求的.
比如搜索hello, 可以直接請求https://finance.yahoo.com/_finance_doubledown/api/resource/searchassist;searchTerm=hello
那么代碼可以這樣寫:
import json
import requests
kw = 'hello'
url_base = 'https://finance.yahoo.com/_finance_doubledown/api/resource/searchassist;searchTerm='
url = url_base + kw
resp = requests.get(url)
print(json.dumps(json.loads(resp.text), indent=4, sort_keys=True))
得到類似的結(jié)果:
{
"hiConf": false,
"items": [
{
"exch": "FRA",
"exchDisp": "Frankfurt",
"name": "HelloFresh SE",
"symbol": "HFG.F",
"type": "S",
"typeDisp": "Equity"
},
...
我嘗試的貌似直接請求即可, 尚不知 yahoo 有沒有限制請求的措施.
這個簡單,python有現(xiàn)成的pprint模塊,拿去
http://blog.csdn.net/iamaiear...
$str = preg_replace('/\s+/', '', $str);
可以使用scp -l
本機(jī):chrome 64 python2.7 selenium3.8
給你試了下headless模式下,登錄后,系統(tǒng)檢測瀏覽器版本太低或不兼容,所以定位不準(zhǔn) 。
如下圖
你可以嘗試在登錄后截圖看下
driver.get_screenshot_as_file(time.strftime("%Y%m%d%H%M%S") + ".png")
最好不要使用for循環(huán)。
df1['group'] = df1['add'].apply(lambda x: df2.loc[[y in x for y in df2['key_word']],'group']).stack().reset_index(name='group')['group']
更新:
另一種方法,處理未收錄的情況
def match_group(x):
for y in df2['key_word']:
if y in x:
return y
return '未收錄'
df1['group'] = df1['add'].apply(match_group)先說答案:.prop( "checked", false )
有興趣可以看看為什么?
https://jquery.com/upgrade-gu...
Prior to jQuery 3.0, using .removeAttr() on a boolean attribute such as checked, selected, or readonly would also set the corresponding named property to false. This behavior was required for ancient versions of Internet Explorer but is not correct for modern browsers because the attribute represents the initial value and the property represents the current (dynamic) value.It is almost always a mistake to use .removeAttr( "checked" ) on a DOM element. The only time it might be useful is if the DOM is later going to be serialized back to an HTML string. In all other cases, .prop( "checked", false ) should be used instead.
text()前面兩個斜杠,或者string(xpath)
你把這個看成一個數(shù)學(xué)問題
階乘是什么?
f(1) = 1
f(n) = n * f(n-1)
所以就是
def f(n):
if n <= 0:
return 0
if n == 1:
return 1
return n * f(n-1)咳咳,先個人覺得 120w 并不大(習(xí)慣吐槽)。然后你既然是分段的,那不若直接建立索引就好了。當(dāng)然,如果說優(yōu)化,確實(shí)是建立新的一個表記錄會比較好些。
其實(shí)我個人理解,數(shù)據(jù)庫的使用就兩種情況,一種用空間換時間,另一種自然是用時間換空間。是我的話,個人會選擇只是優(yōu)化表的索引,然后再進(jìn)行查詢就好,考慮到你做的復(fù)購率的調(diào)查頻率不會很高,用時間作為代價運(yùn)作也是可以的。
我的實(shí)踐中, 這種統(tǒng)計(jì)的數(shù)據(jù), 都是做成中間數(shù)據(jù)。
由一個服務(wù)專門定時在一個時間點(diǎn)去做統(tǒng)計(jì),生成統(tǒng)計(jì)數(shù)據(jù)(月,季度,半年,全年)到新的集合。
也看到過網(wǎng)上有提到采用流的方式做(stom之類的框架)。這種相對復(fù)雜。 具體沒實(shí)踐過。 可以一起交流下。北大青鳥APTECH成立于1999年。依托北京大學(xué)優(yōu)質(zhì)雄厚的教育資源和背景,秉承“教育改變生活”的發(fā)展理念,致力于培養(yǎng)中國IT技能型緊缺人才,是大數(shù)據(jù)專業(yè)的國家
達(dá)內(nèi)教育集團(tuán)成立于2002年,是一家由留學(xué)海歸創(chuàng)辦的高端職業(yè)教育培訓(xùn)機(jī)構(gòu),是中國一站式人才培養(yǎng)平臺、一站式人才輸送平臺。2014年4月3日在美國成功上市,融資1
北大課工場是北京大學(xué)校辦產(chǎn)業(yè)為響應(yīng)國家深化產(chǎn)教融合/校企合作的政策,積極推進(jìn)“中國制造2025”,實(shí)現(xiàn)中華民族偉大復(fù)興的升級產(chǎn)業(yè)鏈。利用北京大學(xué)優(yōu)質(zhì)教育資源及背
博為峰,中國職業(yè)人才培訓(xùn)領(lǐng)域的先行者
曾工作于聯(lián)想擔(dān)任系統(tǒng)開發(fā)工程師,曾在博彥科技股份有限公司擔(dān)任項(xiàng)目經(jī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ù), 熟練的跨平臺面向?qū)ο箝_發(fā)經(jīng)驗(yàn),技術(shù)功底深厚。 授課風(fēng)格 授課風(fēng)格清新自然、條理清晰、主次分明、重點(diǎn)難點(diǎn)突出、引人入勝。
精通HTML5和CSS3;Javascript及主流js庫,具有快速界面開發(fā)的能力,對瀏覽器兼容性、前端性能優(yōu)化等有深入理解。精通網(wǎng)頁制作和網(wǎng)頁游戲開發(fā)。
具有10 年的Java 企業(yè)應(yīng)用開發(fā)經(jīng)驗(yàn)。曾經(jīng)歷任德國Software AG 技術(shù)顧問,美國Dachieve 系統(tǒng)架構(gòu)師,美國AngelEngineers Inc. 系統(tǒng)架構(gòu)師。