注意: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
針對(duì)你修改后的問題, 再加個(gè)函數(shù)就搞定:
# 這個(gè)fuck_all函數(shù)比較特例, 完全是針對(duì)你要區(qū)分的dataset下面的N個(gè)變量信息這種需求
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é)果長(zhǎng)這樣,應(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)
成品
單純看這段配置沒問題
把nginx -T的結(jié)果貼上來吧
你的變量$ceshi好像錯(cuò)了我改了一下,不知道對(duì)不對(duì)
//錯(cuò)誤的
$ceshi='優(yōu)酷視頻$$第1集$http://v.youku.com/$youku#第2集$http://v.youku.com/v_show$youku#第3集$http://v.youku.com/$$$芒果視頻$$第1集$http://vmguo.com$mgtv#第2集$http://v.mangguo.com$mgtv#第3集$http://v.mangguo.com$mgtv';
//我?guī)湍阈薷牧?,其中少?youku這一部分
$ceshi='優(yōu)酷視頻$$第1集$http://v.youku.com/$youku#第2集$http://v.youku.com/v_show$youku#第3集$http://v.youku.com/$youku$$$芒果視頻$$第1集$http://vmguo.com$mgtv#第2集$http://v.mangguo.com$mgtv#第3集$http://v.mangguo.com$mgtv';
$result_array = array();
$temp = explode('$$$',$ceshi);
//var_dump($temp);
foreach($temp as $key=>$value){
$temp_array = (explode('$$',$value));
//當(dāng)前的類別
$category = $temp_array[0];
//內(nèi)容再次進(jìn)行歸類
$temp_array = explode('#',$temp_array[1]);
foreach($temp_array as $key=>$value){
//當(dāng)前的集數(shù)
$temp_value = explode('$',$value);
$ep_number = preg_replace('/(第)||(集)/','',$temp_value[0]);
//需要壓入的數(shù)組
$temp_result['siteSource']= $temp_value[2];
$temp_result['siteName']= $category;
$temp_result['siteLink']= $temp_value[1];
//壓入結(jié)果數(shù)組
$result_array["sitePerEpisode"][$ep_number][]=$temp_result;
}
}
//$result_array為你要的結(jié)果,你可以var_dump看一下
//var_dump($result_array);
//將結(jié)果數(shù)組轉(zhuǎn)化為json,中文字符會(huì)被轉(zhuǎn)化
$json_result = json_encode($result_array,true);
echo $json_result;
未轉(zhuǎn)化為json的array結(jié)果
array(1) {
["sitePerEpisode"]=>
array(3) {
[1]=>
array(2) {
[0]=>
array(3) {
["siteSource"]=>
string(5) "youku"
["siteName"]=>
string(12) "優(yōu)酷視頻"
["siteLink"]=>
string(19) "http://v.youku.com/"
}
[1]=>
array(3) {
["siteSource"]=>
string(4) "mgtv"
["siteName"]=>
string(12) "芒果視頻"
["siteLink"]=>
string(16) "http://vmguo.com"
}
}
[2]=>
array(2) {
[0]=>
array(3) {
["siteSource"]=>
string(5) "youku"
["siteName"]=>
string(12) "優(yōu)酷視頻"
["siteLink"]=>
string(25) "http://v.youku.com/v_show"
}
[1]=>
array(3) {
["siteSource"]=>
string(4) "mgtv"
["siteName"]=>
string(12) "芒果視頻"
["siteLink"]=>
string(20) "http://v.mangguo.com"
}
}
[3]=>
array(2) {
[0]=>
array(3) {
["siteSource"]=>
string(5) "youku"
["siteName"]=>
string(12) "優(yōu)酷視頻"
["siteLink"]=>
string(19) "http://v.youku.com/"
}
[1]=>
array(3) {
["siteSource"]=>
string(4) "mgtv"
["siteName"]=>
string(12) "芒果視頻"
["siteLink"]=>
string(20) "http://v.mangguo.com"
}
}
}
}見:
https://en.wikipedia.org/wiki...
應(yīng)有盡有.
測(cè)試了下 好像在html頁面中確實(shí)無效,但是如果在.vue文件中有效...
但是當(dāng)我在.vue中使用之后,繼續(xù)在html中使用的時(shí)候 發(fā)現(xiàn)又有用了 emmm
....
你好,你可先隨意在一臺(tái)slave的機(jī)器中看下broker打印的日志,該slave是否注冊(cè)到了namesrv中呢?也可以將HA方式改成同步雙寫模式,就可以在producer發(fā)送消息會(huì)返回具體的問題。
你這邊直接運(yùn)行pyc,它的默認(rèn)搜索路徑和預(yù)加載模塊中都沒有AAA,所以不可能識(shí)別出來。正常的流程是運(yùn)行一個(gè)頂層腳本,它的同級(jí)目錄中有多個(gè)依賴的package
yml文件的好處,天然的樹狀結(jié)構(gòu),一目了然,實(shí)質(zhì)上跟properties是差不多的。
參數(shù)類型沒有對(duì),你定義的參數(shù)類型是study.String,而你調(diào)用setName()傳入的是java.lang.String類型的。把方法定義的參數(shù)類型改為java.lang.String就可以了。
insert執(zhí)行成功就會(huì)返回id,這時(shí)候還沒有commit,所以數(shù)據(jù)庫(kù)里還看不到
400:語法格式有誤,服務(wù)器無法理解此請(qǐng)求
前臺(tái)請(qǐng)求怎么寫的?
把你的jps關(guān)掉。
別問我怎么關(guān),我沒用過Intellj...僅僅是從保存信息推斷的
功能全的loadrunner
操作簡(jiǎn)單的jmeter,推薦后者,loadrunner太大了,jmeter比較簡(jiǎn)單,接口測(cè)試會(huì)方便很多
看一下tomcat 日志 catalina_home/logs/catalina.out,會(huì)有報(bào)錯(cuò)信息
據(jù)我分析,web.xml里
<><servlet>
前面這個(gè)"<>" 導(dǎo)致的吧解決了:
homebrew可以從git倉(cāng)庫(kù)中下載。formule沒有就去git倉(cāng)庫(kù)下
沒有找到這兩個(gè)依賴包vue-style-loader css-loader,看下是不是沒裝
java 類的元數(shù)據(jù)在內(nèi)存只存在一份,放在 Permanent Generation space 中,反射出來的方法、字段也只有一份。
不太明白為什么要在前端判斷用戶登陸狀態(tài)。
<html style="height: 100%">
<head>
<meta charset="utf-8">
</head>
<body style="height: 100%; margin: 0">
<div id = "main" style = "height:100%"></div>
<script src="echarts.js"></script>
<script src="http://code.jquery.com/jquery...; type="text/javascript"></script>
<script src="fuzhou.json"></script>
<script>
echarts.registerMap('fuzhou', fuzhou);
var dom = document.getElementById("main");
var app = {};
option = null;
var dataMap = {};
var myChart = echarts.init(dom);
myChart.setOption(option={
baseOption: {
timeline: {
axisType: 'category',
autoPlay: true,
playInterval: 1000,
data: [ ],
label: {
formatter : function(s) {
return s;
}
}
},
tooltip: {
trigger: 'item'
},
visualMap: {
min: 40,
max: 230,
text:['High','Low'],
realtime: false,
calculable: true,
inRange: {
color: ['green','yellow', 'red']
}
},
series: [{
type: 'map',
map: 'fuzhou',
itemStyle:{
normal:{label:{show:true}},
emphasis:{label:{show:true}}
},
}],
},
options:[]
});
</script>
</body>
</html>
北大青鳥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)頁制作和網(wǎng)頁游戲開發(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)師。