فهرست منبع

refactor: Update extract_column_data default column_index and add logging

mrh 1 سال پیش
والد
کامیت
e5c770867f
1فایلهای تغییر یافته به همراه5 افزوده شده و 1 حذف شده
  1. 5 1
      mylib/translate_utils.py

+ 5 - 1
mylib/translate_utils.py

@@ -10,7 +10,7 @@ from mylib.logging_config import setup_logging
 setup_logging()
 logger = logging.getLogger('mylib.translate_utils')
 
-def extract_column_data(data: List[List[str]], column_index: int = 2, start_row: int = 3) -> List[str]:
+def extract_column_data(data: List[List[str]], column_index: int = 1, start_row: int = 3) -> List[str]:
     """提取指定列的数据,默认从第3行开始提取第2列
     
     Args:
@@ -36,6 +36,8 @@ def extract_column_data(data: List[List[str]], column_index: int = 2, start_row:
         # 提取指定列的数据
         column_data = [row[column_index] for row in data[start_row:]]
         logger.info(f"成功提取第{column_index}列数据,从第{start_row}行开始,共{len(column_data)}条数据")
+        # 打印出来
+        logger.info(f"第{column_index}列数据: {column_data}")
         return column_data
         
     except Exception as e:
@@ -135,6 +137,8 @@ def main():
     input_file = output_dir/"测试.csv"
     output_file = output_dir/"processed_测试.csv"
     data = read_csv(input_file)
+    extract_column_data(data)    
+    insert_empty_columns(data, [2])
     # process_batch_translations(data, 2)
 
 if __name__ == "__main__":