Python TQC考題302_迴圈偶數連加 by 儲蓄保險王 · 2022-04-28 #Python TQC考題302_迴圈偶數連加 a=eval(input()) b=eval(input()) sum=0 for i in range(a,b+1): if i%2==0: sum+=i #sum=sum+i print(sum) 相關文章Python 進階實戰:深入 Word 核心,挖出那一坨 BLOB (含自省 Debug 技巧, BLOB= Binary Large Object) ; part = doc.part.rels[rid].target_part ; return part.blob if "ImagePart" in type(part).__name__ else NonePython機器學習: train_test_split() 切割資料為訓練資料跟測試資料; 二元分類 ; 邏輯迴歸 (Logistic Regression); from sklearn.model_selection import train_test_split ; lmLogR= linear_model.LogisticRegression(solver=”sag”, max_iter=10000)Python set 集合 { },交集(intersection) & 像and, 聯集(union) | 像or, 差集(difference)-像減法或not, 對稱差集(symmetric difference)^交集除外 xorPython: 如何使用graphviz套件繪製流程圖? from graphviz import Digraph ; dot = Digraph() ; dot.attr(rankdir='TB', size='10,15') #"TB": Top to Bottom, 從上而下的佈局Python教學:如何把本地圖片傳給 OpenAI Vision API ; "data:image/png;base64," + img_base64}Python: 如何使用functools.reduce逐步縮減可迭代對象,合併為單個結果? import functools; product = functools.reduce( lambda x, y: x * y, numbers) ; reduce(function, sequence [, initial]) -> value ; map(function, iterable) ; filter(function, iterable) ; map ; filterpython 正則表示法的量詞: *(0個以上) +(1個以上) ?(0 or 1個) 與貪婪/非貪婪, ? 的多重角色(量詞、非貪婪修飾、語法)]*>.*?底下插入一個圖檔.*?</w:p>’, flags = re.DOTALL) ; new_xml, n = pattern.subn(”, xml, count=1)' title='Python正則替換:全面掌握 re.sub 與 re.subn 的差異與實戰 #substitute(替換); . 預設匹配「除\n以外的任意單一字元」; pattern = re.compile(r'<w:p[^>]*>.*?底下插入一個圖檔.*?</w:p>’, flags = re.DOTALL) ; new_xml, n = pattern.subn(”, xml, count=1)' loading='lazy' width=350 height=233 />Python正則替換:全面掌握 re.sub 與 re.subn 的差異與實戰 #substitute(替換); . 預設匹配「除\n以外的任意單一字元」; pattern = re.compile(r'<w:p[^>]*>.*?底下插入一個圖檔.*?</w:p>', flags = re.DOTALL) ; new_xml, n = pattern.subn('', xml, count=1)Python: matplotlib繪圖如何共用x axis, y axis, x label, ylabel? fig, axs = plt.subplots(nrows=2, ncols=3, sharex=True, sharey=True) ; plt.suplabel()
0 Python import sys; sys.path; set PYTHONPATH= ; 環境變數; 字串前方加一個 r 是一個特殊的字串前輟旗標; Python的字串中輸入\\,輸出\ , 輸入%%,輸出%;跳脫字元(Escape Characters) 2022-08-19
0 Python 如何做excel的樞紐分析? pandas.DataFrame.groupby() ; .agg( {column name: function name} ) ; 如何讀取多層index的xlsx檔案? df = pandas.read_excel (fpath, index_col =[0,1]) ; 如何顯示所有欄? pd.set_option ( “display.max_columns”, None) 2023-03-20
近期留言