在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/ Java問答
真難過 回答

注意: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)

成品

clipboard.png

大濕胸 回答

你的變量$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"
      }
    }
  }
}
慢半拍 回答

測(cè)試了下 好像在html頁面中確實(shí)無效,但是如果在.vue文件中有效...
但是當(dāng)我在.vue中使用之后,繼續(xù)在html中使用的時(shí)候 發(fā)現(xiàn)又有用了 emmm
....

風(fēng)畔 回答

你好,你可先隨意在一臺(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ù)下

java 類的元數(shù)據(jù)在內(nèi)存只存在一份,放在 Permanent Generation space 中,反射出來的方法、字段也只有一份。

維他命 回答

不太明白為什么要在前端判斷用戶登陸狀態(tài)。

  1. token的過期時(shí)間應(yīng)該是后臺(tái)設(shè)置,前端通過token存在與否判斷用戶是否登陸本身時(shí)間上就不統(tǒng)一
  2. 如果token作為用戶狀態(tài)憑證,應(yīng)該要發(fā)送給后臺(tái)驗(yàn)證才行,而不是前端驗(yàn)證
安若晴 回答

<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>