自己建立的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: 使用 flat_list.extend( List[pandas.Series] ) 實現 pandas.DataFrame 列擴展教學 Python: 使用 flat_list.extend( List[pandas.Series] ) 實現 pandas.DataFrame 列擴展教學](https://i2.wp.com/savingking.com.tw/wp-content/uploads/2025/04/20250421141348_0_14cedf.png?quality=90&zoom=2&ssl=1&resize=350%2C233)




近期留言