Loading...
Loading...
Compare original and translation side by side
from markitdown import MarkItDown
md = MarkItDown()
result = md.convert("document.pdf")
print(result.text_content)from markitdown import MarkItDown
md = MarkItDown()
result = md.convert("document.pdf")
print(result.text_content)undefinedundefinedundefinedundefinedexport OPENAI_API_KEY="sk-..."export OPENAI_API_KEY="sk-..."undefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedundefinedfrom pathlib import Path
md = MarkItDown()
documents = Path(".").glob("*.pdf")
for doc in documents:
result = md.convert(str(doc))
output_path = doc.with_suffix(".md")
output_path.write_text(result.text_content)from pathlib import Path
md = MarkItDown()
documents = Path(".").glob("*.pdf")
for doc in documents:
result = md.convert(str(doc))
output_path = doc.with_suffix(".md")
output_path.write_text(result.text_content)undefinedundefined
**Requirements**: Python 3.10 or higher
**要求**:Python 3.10或更高版本| File Type | Use Case | Command |
|---|---|---|
| Reports, papers | | |
| Word | Documents | |
| Excel | Data tables | |
| PowerPoint | Presentations | |
| Images | Diagrams with OCR | |
| HTML | Web pages | |
| ZIP | Archives | |
| 文件类型 | 使用场景 | 命令 |
|---|---|---|
| 报告、论文 | | |
| Word | 文档 | |
| Excel | 数据表格 | |
| PowerPoint | 演示文稿 | |
| 图片 | 带OCR的图表 | |
| HTML | 网页 | |
| ZIP | 压缩包 | |
undefinedundefined
**Anti-Pattern 2: Unvalidated File Paths**
```python
**反模式2:未验证的文件路径**
```python
**Anti-Pattern 3: Ignoring File Size Limits**
```python
**反模式3:忽略文件大小限制**
```pythonundefinedundefinedpip install 'markitdown[all]'pip install 'markitdown[all]'