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

鍍金池/ 問答/ Python問答
生性 回答

換行符,替換一下就行了,系統(tǒng)差異

在vim中執(zhí)行 :%s/^M/\r/g 全部替換成換行符
注意^M是“CTRL-V CTRL-M”而不是“SHIFT-6 M”



pycharm 在
Settings -> Code Style -> General -> Line Separator 改成 \n 就行了
巷尾 回答
student = Student()

# 上面一種
student.age    # 返回 25
student.age()  # 25是數(shù)字不是函數(shù),不能執(zhí)行,報錯

# 下面一種
student.age    # 返回匿名函數(shù)
student.age()  #  執(zhí)行這個匿名函數(shù),返回25
陌璃 回答

你得考慮意外退出的情況,比如ctrl-c

我甘愿 回答

已實現(xiàn)

from matplotlib import colors
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
cmap = colors.ListedColormap(['white','gray','blue','yellow'])
bounds=[0, 2, 4, 6, 8]
norm = colors.BoundaryNorm(bounds, cmap.N)
data = np.array([[1,1,1,1,7,7,7,7], [1,1,1,1,1,1,1,5], [1,1,1,1,1,1,1,5], [1,1,1,3,1,1,1,5], [1,1,1,1,1,1,3,5]])
ax = sns.heatmap(data, cmap=cmap, norm=norm, linewidths=.5, linecolor='black', square=True, cbar=False)
sns.plt.annotate('S', (1.4, 3.4))
sns.plt.show()

圖片描述

扯機薄 回答

建議把
UPLOAD_FOLDER = '/var/www/cardShow/app/static'
改成
UPLOAD_FOLDER = '/var/www/cardShow/app/static/'

慢半拍 回答

中文字體超出了ascii的編碼范圍,解析不出來,換成utf-8試試

筱饞貓 回答

任務(wù)欄右下角通知區(qū)域

pyinstaller的作用是將程序打包為相應平臺的可執(zhí)行文件,與開機啟動和系統(tǒng)托盤沒關(guān)系。
這個功能應該由相關(guān)的gui庫實現(xiàn),如gtk的GtkStatusIcon

開機啟動

  1. 把你的可執(zhí)行文件鏈接一個快捷方式到C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp
  2. windows的定時任務(wù)
  3. 通過其他語言比如C注冊一個系統(tǒng)服務(wù)
  4. 可能還有其他我不知道的方法
陪我終 回答

圖片描述

這涉及到作用域的問題。自己體會一下吧。

浪蕩不羈 回答
def foo(s):
    if not s:
        return 0
    length = len(s)
    if length == 1:
        return s[0]
    exp = '(' + str(s[0]) + ')'
    for i in range(1, length):
        if s[i-1] < s[i] and s[i-1] != 0:
            op = '*'
        else:
            op = '+'
        exp = exp + op + '(' + str(s[i]) + ')'
    print(eval(exp))
>>> foo([4])
4
>>> foo([])
0
>>> foo([10, 2])
12
>>> foo([2, 10])
20
>>> foo([2, 100, 3, 10, 4])
234
>>> foo([2, 100, 0, 5])
205
>>> foo([-3, -10, -1])
7

中文數(shù)字轉(zhuǎn)阿拉伯數(shù)字(遞歸版本)

d = { '一': 1, '二': 2, '三': 3, '四': 4, '五': 5, '六': 6, '七': 7, '八': 8, '九': 9}

def _trans(s):
    num = 0
    if s:
        idx_q, idx_b, idx_s = s.find('千'), s.find('百'), s.find('十')
        if idx_q != -1:
            num += d[s[idx_q-1:idx_q]] * 1000
        if idx_b != -1:
            num += d[s[idx_b-1:idx_b]] * 100
        if idx_s != -1:
            # 一十的一可被省略
            num += d.get(s[idx_s-1:idx_s], 1) * 10
        if s[-1] in d:
            num += d[s[-1]]
    return num
def trans(chn):
    chn = chn.replace('零', '')
    idx_y = chn.rfind('億')
    idx_w = chn.rfind('萬')
    if idx_y > idx_w:
        idx_w = -1     
    num_y = 100000000
    num_w = 10000
    if idx_y != -1 and idx_w != -1:
        return trans(chn[:idx_y])*num_y + _trans(chn[idx_y+1:idx_w])*num_w + _trans(chn[idx_w+1:])
    elif idx_y != -1:
        return trans(chn[:idx_y])*num_y + _trans(chn[idx_y+1:])
    elif idx_w != -1:
        return _trans(chn[:idx_w])*num_w + _trans(chn[idx_w+1:])
    return _trans(chn)
print(1,trans('一萬億二千一百萬零一百零一')) # 1000021000101
print(2,trans('一萬億零二千一百零一')) # 1000000002101
print(3,trans('二千一百零一')) # 2101
print(4,trans('三十五萬六千一百')) # 356100
print(5,trans('二億三十萬六千一百')) # 200306100
print(6,trans('二億億三十萬六千一百')) # 20000000000306100
print(7,trans('十')) # 10
print(8,trans('三百零五')) # 305
print(9,trans('一億零二百三十萬億四千零五十六萬七千八百九十')) # 10230000040567890
你好胸 回答

@kennyD 你好,請幫忙查看怎么操作, 我這里是這樣子的!

蔚藍色 回答

這只是編碼格式問題,有什么關(guān)系?

何蘇葉 回答

c++中的at(x, y) 仍然將x, y轉(zhuǎn)換為int, 即取矩陣指定行列的值, 與python中常用的flow[x, y]相同, 但不知為什么c++和python的結(jié)果偏差很大, 或者是因為python的值轉(zhuǎn)換為int類型的關(guān)系??

瞄小懶 回答

看情況是沒有安裝urllib3,可以先使用pip安裝了urllib3。

挽歌 回答

macos 內(nèi)置的是python2 你使用pip3會將pangu裝到python3去,因為你沒有設(shè)置默認使用的是系統(tǒng)的python2運行py文件,所以pangu不存在

壞脾滊 回答

檢查一下數(shù)據(jù)庫字符集

show variables like 'character_set_%';

show creat table you_table_name;

看看不是都是utf-8

孤巷 回答

“會把不需要更新的字段全部刪除” 是啥意思?
比如:
表里有name/age/email等字段
.update(name='zhangsan', age=18) 之后,
email等別的字段值沒了? 不能吧

糖果果 回答

1.你的語法沒有報錯,應該就是你登錄失敗了
2.你查一查你的post參數(shù)是不是全的
3.tesseract是有python包的,你不用自己運行命令
4.說不定是你tesseract識別錯誤,你可以寫個循環(huán),登錄失敗就再次嘗試
5.一般系統(tǒng)是有驗證碼的驗證功能的,你可以給提前驗證驗證碼,確保post正確驗證碼

鹿惑 回答

以后你在使用origin的時候就是你指定的的遠程倉庫 git@github.com:suiweinuv/demo1.git ,你也可以起個自己好記的名字。

陌上花 回答

在正則表達式中使用“()”會讓括號中的內(nèi)容變成一個“組”,要達到你的要求,應改成(?:com|cn)

貓館 回答

只要你想細分,或者你的業(yè)務(wù)需要細分,那還可以分成好幾層

  • Repository 層
  • Action 層
  • Service 層