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

鍍金池/ 問答/ Python問答
愿如初 回答

。。主題less可以放在你的自己項目目錄下管理,就行了吖。

別瞎鬧 回答

(?P<charset>1+)這是我不懂之處,查閱博客之后才知道這個算是為分組命名,在.group('charset')這里將原先的分組的名字當(dāng)做字符串參數(shù)傳入,可以準(zhǔn)確獲取到正則表達(dá)式匹配到的值。


  1. ;s ?
孤巷 回答

“會把不需要更新的字段全部刪除” 是啥意思?
比如:
表里有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)

成品

clipboard.png

敢試 回答

沒有用過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屬性值).

參考https://developer.mozilla.org...

她愚我 回答

感謝β_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 文件。

背叛者 回答

javascript本身就是綜合了c /java等語言的設(shè)計方式進(jìn)行改良的,內(nèi)存空間的理解建議你要對瀏覽器工作機制進(jìn)行深入理解,原型鏈個人覺得理解與比例解就在一念之間,相對來說在JS的學(xué)習(xí)中算是中等難度的。閉包只是個抽象的詞,從另一面就是來說明作用域的。對于原型鏈的了解建議去看JQzepto這些框架源碼,如果要了解作用域空間等,紅寶書是必修課,后續(xù)在讀犀牛書,兩本葵花寶典,讀完至少一兩年。。。哈哈哈哈------