我的這個項目會對你有所幫助的——https://github.com/eastossifr...
。。主題less可以放在你的自己項目目錄下管理,就行了吖。
“會把不需要更新的字段全部刪除” 是啥意思?
比如:
表里有name/age/email等字段
.update(name='zhangsan', age=18) 之后,
email等別的字段值沒了? 不能吧
匹配任意非換行字符 匹配結(jié)果可以0條 不關(guān)心匹配結(jié)果
和上面一樣 只不過這個關(guān)心匹配結(jié)果并保存到組
和第一個一樣
問題解決,可能是網(wǎng)絡(luò)代理的問題,我翻墻之后就能成功安裝了,但我依然有疑問我之前是有安裝成功的,不需要翻墻,問題出在哪里?
我有想改過pyenv的安裝源,但沒有找到相應(yīng)的配置安裝源的位置,不知道是否會受brew安裝源更改的影響呢?這是前一次安裝和本次安裝的區(qū)別。
相當(dāng)于就是php給python下發(fā)要訪問的網(wǎng)頁?
php的內(nèi)容可以存到redis里,scrapy繼承一個RedisSpider的類就實現(xiàn)了從redis里面獲取數(shù)據(jù)分布式爬,可以去了解一下
用 HTML 處理就不會帶名字空間:
# -*- coding: utf-8 -*-
from lxml import etree
content = '''
<?xml version='1.0' encoding='utf-8'?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="calibre:cover" content="true"/>
<title>Cover</title>
<style type="text/css" title="override_css">
@page {padding: 0pt; margin:0pt}
body { text-align: center; padding:0pt; margin: 0pt; }
</style>
</head>
<body>
<div>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="100%" height="100%" viewBox="0 0 200 266" preserveAspectRatio="none">
<image width="200" height="266" xlink:href="cover1.jpeg"/>
</svg>
</div>
</body>
</html>
'''
print etree.tostring(etree.HTML(content).xpath('//body/*')[0])
E+F { sRules } 選擇緊貼在E元素之后F元素,元素E與F必須同屬一個父級。
E F { sRules } 選擇所有被E元素包含的F元素。
建議使用pyinstaller打包,穩(wěn)定方便。
你這個錯誤是因為你setup(console=["conversion_rate.py"])這里面參數(shù)太少了。
注意:python3以后才支持yield from語法
import collections
def flatten(d, prefix="", sep="_"):
def _take_prefix(k, v, p):
if p:
yield from flatten(v, "{}{}{}".format(p, sep, k))
else:
yield from flatten(v, str(k))
if isinstance(d, dict):
for k, v in d.items():
if isinstance(v, str) or not isinstance(v, collections.Iterable):
if prefix:
yield "{}{}{}".format(prefix, sep, k), v
else:
yield k, v
elif isinstance(v, dict):
yield from _take_prefix(k, v, prefix)
elif isinstance(v, list):
for i in v:
yield from _take_prefix(k, i, prefix)
else:
pass
else:
pass
dic = {your dataset}
for key, value in flatten(dic):
print("{}: {}".format(key, value))
結(jié)果如下,應(yīng)該能拍平了
status: changed
dataset_id: 5a4b463c855d783af4f5f695
dataset_name: AE_E
dataset_label: 1- ADVERSE EVENTS - Not Analyzed
details_variables_variable_id: 5a4b4647855d783b494f9d3f
details_variables_variable_name: CPEVENT
details_variables_variable_label: CPEVENT
details_variables_status: changed
details_variables_details_r_type_new_value: unary
details_variables_details_r_type_old_value: factor
details_variables_message: Variable with different R Type
details_variables_variable_id: 5a4b4647855d783b494f9d25
details_variables_variable_name: CPEVENT2
details_variables_variable_label: CPEVENT2
details_variables_status: changed
details_variables_details_r_type_new_value: unary
details_variables_details_r_type_old_value: binary
details_variables_message: Variable with different R Type
details_variables_variable_id: 5a4b4647855d783b494f9d26
details_variables_variable_name: CP_UNSCHEDULED
details_variables_variable_label: CP_UNSCHEDULED
details_variables_status: changed
details_variables_details_r_type_new_value: undefined
details_variables_details_r_type_old_value: unary
details_variables_message: Variable with different R Type
details_variables_variable_id: 5a4b4647855d783b494f9d02
details_variables_variable_name: VISIT_NUMBER
details_variables_variable_label: VISIT_NUMBER
details_variables_status: changed
details_variables_details_r_type_new_value: unary
details_variables_details_r_type_old_value: integer
details_variables_message: Variable with different R Type
details_variables_variable_id: 5a4b4647855d783b494f9ccf
details_variables_variable_name: VISIT_NUMBER2
details_variables_variable_label: VISIT_NUMBER2
details_variables_status: changed
details_variables_details_r_type_new_value: unary
details_variables_details_r_type_old_value: binary
details_variables_message: Variable with different R Type
details_many_visits: None
針對你修改后的問題, 再加個函數(shù)就搞定:
# 這個fuck_all函數(shù)比較特例, 完全是針對你要區(qū)分的dataset下面的N個變量信息這種需求
def fuck_all(dic, prefix="details_variables"):
lst = list(flatten(dic)) # flatten函數(shù)則比較通用,任何嵌套數(shù)據(jù)集都可以用它拍平
lines = []
top = {k: v for k, v in lst if not k.startswith(prefix)}
index = 0
for key, value in lst:
if not key.startswith(prefix):
continue
else:
if not lines:
lines.append(top.copy())
if key in lines[index].keys():
index += 1
lines.append(top.copy())
lines[index][key] = value
return lines
d = {your dataset}
for i in fuck_all(d):
print(i)
結(jié)果長這樣,應(yīng)該是能滿足你需求了
{'status': 'changed', 'dataset_id': '5a4b463c855d783af4f5f695', 'dataset_name': 'AE_E', 'dataset_label': '1- ADVERSE EVENTS - Not Analyzed', 'details_many_visits': None, 'details_variables_variable_id': '5a4b4647855d783b494f9d3f', 'details_variables_variable_name': 'CPEVENT', 'details_variables_variable_label': 'CPEVENT', 'details_variables_status': 'changed', 'details_variables_details_r_type_new_value': 'unary', 'details_variables_details_r_type_old_value': 'factor', 'details_variables_message': 'Variable with different R Type'}
{'status': 'changed', 'dataset_id': '5a4b463c855d783af4f5f695', 'dataset_name': 'AE_E', 'dataset_label': '1- ADVERSE EVENTS - Not Analyzed', 'details_many_visits': None, 'details_variables_variable_id': '5a4b4647855d783b494f9d25', 'details_variables_variable_name': 'CPEVENT2', 'details_variables_variable_label': 'CPEVENT2', 'details_variables_status': 'changed', 'details_variables_details_r_type_new_value': 'unary', 'details_variables_details_r_type_old_value': 'binary', 'details_variables_message': 'Variable with different R Type'}
{'status': 'changed', 'dataset_id': '5a4b463c855d783af4f5f695', 'dataset_name': 'AE_E', 'dataset_label': '1- ADVERSE EVENTS - Not Analyzed', 'details_many_visits': None, 'details_variables_variable_id': '5a4b4647855d783b494f9d26', 'details_variables_variable_name': 'CP_UNSCHEDULED', 'details_variables_variable_label': 'CP_UNSCHEDULED', 'details_variables_status': 'changed', 'details_variables_details_r_type_new_value': 'undefined', 'details_variables_details_r_type_old_value': 'unary', 'details_variables_message': 'Variable with different R Type'}
{'status': 'changed', 'dataset_id': '5a4b463c855d783af4f5f695', 'dataset_name': 'AE_E', 'dataset_label': '1- ADVERSE EVENTS - Not Analyzed', 'details_many_visits': None, 'details_variables_variable_id': '5a4b4647855d783b494f9d02', 'details_variables_variable_name': 'VISIT_NUMBER', 'details_variables_variable_label': 'VISIT_NUMBER', 'details_variables_status': 'changed', 'details_variables_details_r_type_new_value': 'unary', 'details_variables_details_r_type_old_value': 'integer', 'details_variables_message': 'Variable with different R Type'}
{'status': 'changed', 'dataset_id': '5a4b463c855d783af4f5f695', 'dataset_name': 'AE_E', 'dataset_label': '1- ADVERSE EVENTS - Not Analyzed', 'details_many_visits': None, 'details_variables_variable_id': '5a4b4647855d783b494f9ccf', 'details_variables_variable_name': 'VISIT_NUMBER2', 'details_variables_variable_label': 'VISIT_NUMBER2', 'details_variables_status': 'changed', 'details_variables_details_r_type_new_value': 'unary', 'details_variables_details_r_type_old_value': 'binary', 'details_variables_message': 'Variable with different R Type'}
送佛送到西好了
from functools import reduce
import json
import pandas as pd
with open("your dataset file", "r") as fh:
dic = json.load(fh)
df = pd.DataFrame(reduce(lambda x, y: x + y, (fuck_all(i) for i in dic)))
df.to_csv("out.csv", index=False)
成品
沒有用過Thonny, 看上去Thonny是與系統(tǒng)的Python安裝地址是分開的,你可以看看你自己的ide Thonny的安裝包所在位置下是否有,沒有的話可以通過Thonny提供的Tools → Open system shell 來安裝
pip 安裝的的庫通常在下面類似的目錄下,你可以查看一下你的系統(tǒng)相應(yīng)目錄下是否有相應(yīng)的目錄
python2.7
/usr/local/lib/python2.7/dist-packages
/usr/lib/python2.7/site-packages
python3.5
/usr/local/lib/python3.5/dist-packages
/usr/lib/python3.5/site-packages
如果用VIRTUAL_ENV, 則會保存在相應(yīng)環(huán)境的下的lib/pythonX.Y/dist-packages下
也可以用pip list加上pip show查看具體有哪些庫和安裝位置。
1.segmentfault可以上傳圖片
2.創(chuàng)建好項目后,svn會自動生成鏈接
因為/g的原因
reg = /1/g
s = '1'
reg.test(s) // true
reg.test(s) // false
reg = /1/
reg.test(s) // true
reg.test(s) // true
當(dāng)設(shè)置全局標(biāo)志的正則使用test()
如果正則表達(dá)式設(shè)置了全局標(biāo)志,test() 的執(zhí)行會改變正則表達(dá)式 lastIndex屬性。連續(xù)的執(zhí)行test()方法,后續(xù)的執(zhí)行將會從 lastIndex 處開始匹配字符串,(exec() 同樣改變正則本身的 lastIndex屬性值).
感謝β_3000的啟發(fā),原來好多東西在紙上畫畫就會清楚很多。
a = arange(12).reshape(3,4)
i = array( [ [0,1],
[1,2] ] )
j = array( [ [2,1],
[3,3] ] )
print(a[i])
print(a[i,j])
a是一個二維數(shù)組,用二維數(shù)組i索引后竟然變成一個三維數(shù)組,如圖:
那么a[i,j]就是在a[i]上再按j索引一次?我不知道對不對,至少從結(jié)果上看是對了。
flask 的靜態(tài)文件需要你使用 url_for() 函數(shù)一個一個的導(dǎo)入。你可以參考一下我的項目
1、https://github.com/eastossifr... 這是藍(lán)圖設(shè)置的 templates 文件夾和 static 文件夾。
2、https://github.com/eastossifr...
這是一個一個調(diào)用靜態(tài)文件,如 js、css 和 img 文件。
print這個看一下吧
javascript本身就是綜合了c /java等語言的設(shè)計方式進(jìn)行改良的,內(nèi)存空間的理解建議你要對瀏覽器工作機制進(jìn)行深入理解,原型鏈個人覺得理解與比例解就在一念之間,相對來說在JS的學(xué)習(xí)中算是中等難度的。閉包只是個抽象的詞,從另一面就是來說明作用域的。對于原型鏈的了解建議去看JQ或zepto這些框架源碼,如果要了解作用域空間等,紅寶書是必修課,后續(xù)在讀犀牛書,兩本葵花寶典,讀完至少一兩年。。。哈哈哈哈------
我剛好寫過這個邏輯,你想要問什么?
北大青鳥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)機構(gòu),是中國一站式人才培養(yǎng)平臺、一站式人才輸送平臺。2014年4月3日在美國成功上市,融資1
北大課工場是北京大學(xué)校辦產(chǎn)業(yè)為響應(yīng)國家深化產(chǎn)教融合/校企合作的政策,積極推進(jìn)“中國制造2025”,實現(xiàn)中華民族偉大復(fù)興的升級產(chǎn)業(yè)鏈。利用北京大學(xué)優(yōu)質(zhì)教育資源及背
博為峰,中國職業(yè)人才培訓(xùn)領(lǐng)域的先行者
曾工作于聯(lián)想擔(dān)任系統(tǒng)開發(fā)工程師,曾在博彥科技股份有限公司擔(dān)任項目經(jīng)理從事移動互聯(lián)網(wǎng)管理及研發(fā)工作,曾創(chuàng)辦藍(lán)懿科技有限責(zé)任公司從事總經(jīng)理職務(wù)負(fù)責(zé)iOS教學(xué)及管理工作。
浪潮集團(tuán)項目經(jīng)理。精通Java與.NET 技術(shù), 熟練的跨平臺面向?qū)ο箝_發(fā)經(jīng)驗,技術(shù)功底深厚。 授課風(fēng)格 授課風(fēng)格清新自然、條理清晰、主次分明、重點難點突出、引人入勝。
精通HTML5和CSS3;Javascript及主流js庫,具有快速界面開發(fā)的能力,對瀏覽器兼容性、前端性能優(yōu)化等有深入理解。精通網(wǎng)頁制作和網(wǎng)頁游戲開發(fā)。
具有10 年的Java 企業(yè)應(yīng)用開發(fā)經(jīng)驗。曾經(jīng)歷任德國Software AG 技術(shù)顧問,美國Dachieve 系統(tǒng)架構(gòu)師,美國AngelEngineers Inc. 系統(tǒng)架構(gòu)師。