自己建立的csv檔案:

除了奇異的那一列
每一列都有四筆資料
要如何取出第四直欄?
如果直接取的話
因為奇異列的長度太短
會出現
IndexError: list index out of range
用try~except~語法
pass IndexError
#沒縮排會出現 ValueError: I/O operation on closed file.
#奇異列為一個空白跟一個空元素

推薦hahow線上學習python: https://igrape.net/30afN

例外觸發程序:

捕捉例外狀況:

推薦hahow線上學習python: https://igrape.net/30afN


![Python如何讀取excel檔(.xlsx)?如何用欄標籤提取某一直行?df=pandas.read_excel() ; df[“欄標籤”] Python如何讀取excel檔(.xlsx)?如何用欄標籤提取某一直行?df=pandas.read_excel() ; df[“欄標籤”]](https://i1.wp.com/savingking.com.tw/wp-content/uploads/2022/11/20221109163631_39.png?quality=90&zoom=2&ssl=1&resize=350%2C233)





![Python-docx 圖片提取完全指南:從 rId 到二進位資料的探險rid ; part = doc.part.rels[rid].target_part #return part.blob if “ImagePart” in type(part).__name__ else None Python-docx 圖片提取完全指南:從 rId 到二進位資料的探險rid ; part = doc.part.rels[rid].target_part #return part.blob if “ImagePart” in type(part).__name__ else None](https://i2.wp.com/savingking.com.tw/wp-content/uploads/2026/01/20260113135812_0_8fa645.png?quality=90&zoom=2&ssl=1&resize=350%2C233)

近期留言