黃珍甄Python自訂函數迴圈範圍range寫入模式a,x,w,r
期中考拷貝文字模式自己排版 write寫入檔案模式mode w=write會覆蓋原有檔案, a=append接續原來檔案, x=create創立新檔案, x與w有何不同? write寫入檔案,預設不換行,換行'\n' print呈現在螢幕,預設換行,不換行end=''。 write寫入用到英文以外的字元(一,a,b)encoding='utf8' VS Code是微軟公司開發的免費IDE,整合開發環境,Integrated Development Environment 期中考拷貝自撰寫模式 write寫入檔案模式mode w=write會覆蓋原有檔案, a=append接續原來檔案, x=create創立新檔案, x與w有何不同? write寫入檔案,預設不換行,換行'\n' print呈現在螢幕,預設換行,不換行end=''。 write寫入用到英文以外的字元(一,a,b)encoding='utf8' VS Code是微軟公司開發的免費IDE,整合開發環境,Integrated Development Environment 圖片 程式碼 space, slash, backslash, cr = ' ', '/', '\\', '\n' def row1(k,m):#定義自訂函數 for i in range(1, k+1): for ii in range(m): for j in range(k-i): f.write(space) f.write(slash) for j in range(2*i-2): f.write(space) f.write(backslash) for j in range(k-i): f.write(space) f.write(cr) def row2(r,m): fo...