Print a section with title and content.
(title: str, content: List[str], output_file=None)
| 537 | |
| 538 | |
| 539 | def print_section(title: str, content: List[str], output_file=None) -> None: |
| 540 | """Print a section with title and content.""" |
| 541 | lines = [f"\n=== {title} ==="] |
| 542 | |
| 543 | if isinstance(content, list): |
| 544 | lines.extend(content if content else ["None found."]) |
| 545 | elif isinstance(content, str): |
| 546 | lines.append(content) |
| 547 | |
| 548 | text = '\n'.join(lines) + '\n' |
| 549 | |
| 550 | if output_file: |
| 551 | output_file.write(text) |
| 552 | else: |
| 553 | print(text, end='') |
| 554 | |
| 555 | |
| 556 | def main(): |