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

鍍金池/ 問答/ Python問答
尛曖昧 回答

主要分為兩種日志,錯誤日志和分析日志

錯誤由各個模塊拋出,在最上層統(tǒng)一處理錯誤,并輸出錯誤信息到錯誤日志
分析日志一般用于統(tǒng)計,一般一次請求就一個,包含和這次請求所有相關的信息,其中也包括一些統(tǒng)計指標

使用 github.com/sirupsen/logrus + github.com/sohlich/elogrus 收集日志到 es,基于 es 作統(tǒng)計分析,以及監(jiān)控報警

硬扛 回答

可以try一下,沒有頁面的時候catch到回調回來

try
    ...
catch
    ...
痞性 回答

你安裝的這個,應該是:import mysql.connector

使用 MySQLdb 的話,報錯信息和這里(http://www.runoob.com/python/... )提到的一樣,應該是沒有正確安裝拓展包。
可以去這里下載:https://sourceforge.net/proje...

怣痛 回答

貼一段代碼給你參考參考吧:

import xlwt

def set_style(name,height,bold=False):
    style = xlwt.XFStyle()

    font = xlwt.Font()
    font.name = name
    font.bold = bold
    font.color_index = 4
    font.height = height

    style.font = font

    return style


def write_excel():
    f = xlwt.Workbook()

    sheet1 = f.add_sheet(u'sheet1',cell_overwrite_ok=True)
    row0 = ['1','2','3','4','5','6','7','8']
    column0 = ['a','b','c','d','e']
    status = ['q1','q2','q3','q4']

    for i in range(0,len(row0)):
        sheet1.write(0,i,row0[i],set_style('Times New Roman',220,True))

    i, j = 1, 0
    while i < 4*len(column0) and j < len(column0):
        sheet1.write_merge(i,i+3,0,0,column0[j],set_style('Arial',220,True))
        sheet1.write_merge(i,i+3,7,7)
        i += 4
        j += 1

    sheet1.write_merge(21,21,0,1,'total',set_style('Times New Roman',220,True))

    i = 0
    while i < 4*len(column0):
        for j in range(0,len(status)):
            sheet1.write(j+i+1,1,status[j])
        i += 4

    f.save('demo1.xls')

if __name__ == '__main__':
    write_excel()

clipboard.png

大濕胸 回答

urls.py配置了嗎,參考
urlpatterns = [

url(r'^admin/', admin.site.urls),
url(r'^index/', index)

]
然后要運行django服務。瀏覽器輸http://127.0.0.1:8000/index/就可以了。

乞許 回答

提示說的很清楚,沒有這個方法,就自己寫一個這個方法。

def create_node(tag, property_map, content):  
    '''''新造一個節(jié)點 
       tag:節(jié)點標簽 
       property_map:屬性及屬性值map 
       content: 節(jié)點閉合標簽里的文本內容 
       return 新節(jié)點'''  
    element = Element(tag, property_map)  
    element.text = content  
    return element 
    
    

需要增加節(jié)點的地方調用一下這個函數就可以了。

情未了 回答

根據最后一行錯誤信息

OpenGL.error.NullFunctionError: Attempt to call an undefined function glutInit, check for bool(glutInit) before calling

搜索一下即可得到結果。

  1. 確保在 Python26\Lib\site-packages\OpenGL\DLLS 下有 glut32.dll

According to the link below the problem was with the glut installation rather than pip install. It seems glut files are not part of PyOpenGL or PyOpenGL_accelerate package. You have to download them seperately.

Windows user can use the link below to download glut as mentioned in the given link.

ftp://ftp.sgi.com/opengl/glut/glut3.html.old#windows

Linux Users can just install glut using the following command:

sudo apt-get install freeglut3-dev

引用

https://stackoverflow.com/que...

墨沫 回答

方法1 修改PATHONPATH環(huán)境變量
方法2 加載它之前修改sys.path,方法sys.path.insert

久愛她 回答

pip3是把模塊裝在了python3下,而運行python實際啟動的可能是python2

最簡單的辦法是使用python3這個軟鏈接,而不是python。

愿意動手的可以用下面的辦法:
mac自帶的python在/System/Library/Frameworks/Python.framework/usr/bin/python下,因為操作系統(tǒng)自己也要用,所以它不希望你改成別的版本的。 但你可以修改/usr/local/bin下的軟鏈接。
同時修改PATH變量(如通過~/.bashrc文件),讓/usr/local/bin排在前面。這樣在終端里可以用你想要的版本了。

還吻 回答
  1. angle['ratio'] 不是表格嗎?
    angle 是表格,angle['ratio'] 是選出 'ratio' 那一列的數據。
  2. 為什么能與 n 判斷相等?angle['ratio']==n 不是返回的是布爾值嗎,為什么能作為angle[angle['ratio']==n]的索引?
    選出 ratio 那列數據之后,數組中的每個元素分別與 n 進行比較,得到一個 bool 數組。選出 [0.5, 0.75, 1.0, 1.5, 1.75] 判斷是否與1相等,得到 [false, false, true, false, false]。numpy 提供了 bool 數組索引的機制,所以返回 true 對應的那一行。
  3. temp.index[0] 是什么意思?
    返回 temp 這張表的第 0 行的索引值。這里你在構建 angle 的時候沒有指定索引,所以默認用數字做索引,所以返回 0。
  4. 為什么最后 return 返回的是元組?
    你函數里寫的是 return beta1, beta2, alpha,python 中對于多返回值是用 tuple 打包處理的

P.S.
看到前面我以為你 pandas 基礎為 0,看到最后一個問題我才知道你 python 基礎為 0,好好找本書看看吧。

眼雜 回答

謝邀,這個情況文檔有談到了:

However, unlike F() objects in filter and exclude clauses, you can’t introduce joins when you use F() objects in an update – you can only reference fields local to the model being updated. If you attempt to introduce a join with an F() object, a FieldError will be raised:

# This will raise a FieldError
>>> Entry.objects.update(headline=F('blog__name'))

詳情:https://docs.djangoproject.co...

所以我覺得要么用sql語句,要么用循環(huán)逐一設置:

for item in A.objects.all():
    item.name = item.b.name
    item.save()
巴扎嘿 回答

如果使用selenium

print(browser.page_source.encode('utf-8').decode(), file=open("xxx.html","w", encoding='utf-8'))

如果使用的純PhantomJS
建議:http://blog.sina.com.cn/s/blo...

伐木累 回答

請仔細看你的debug倒數第二行:

Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/idna'

意思說,壓根沒安裝成功,你白高興了一場。

你的瞳 回答
for i in range(20) {
    for j in range(20) {
        ...
    }
}
8. Compound statements
脾氣硬 回答

更優(yōu)雅的方案就是,弄清楚,這個函數的結果究竟應該是返回什么東西以及之后被如何使用?

真難過 回答

具體內容樣例有沒有,基本思路可以用字符串相關操作比如replace或者正則實現

只愛你 回答

可以把他轉化成int再排序

df = pd.DataFrame({'a':['101','1011','201']})
df['a'] = df['a'].astype(int)
df.sort(['a'])
#輸出
      a
0   101
2   201
1  1011
首頁 上一頁 1 2 3 4 5 6 7 8 下一頁 尾頁