读取Markdown文件。 参数: - file_path (str): 文件路径。 - encoding (str): 文件编码格式,默认为 'utf-8'。 返回: - str: 读取的Markdown文件内容。
(file_path, encoding='utf-8')
| 278 | |
| 279 | |
| 280 | def read_markdown(file_path, encoding='utf-8'): |
| 281 | """ |
| 282 | 读取Markdown文件。 |
| 283 | |
| 284 | 参数: |
| 285 | - file_path (str): 文件路径。 |
| 286 | - encoding (str): 文件编码格式,默认为 'utf-8'。 |
| 287 | |
| 288 | 返回: |
| 289 | - str: 读取的Markdown文件内容。 |
| 290 | """ |
| 291 | with open(file_path, 'r', encoding=encoding) as f: |
| 292 | logger.info(f"读取Markdown文件: {file_path}") |
| 293 | return f.read() |
| 294 | |
| 295 | |
| 296 | def read_jsonl(file_path, chunk_size, line_threshold, encoding='utf-8'): |