# PythonLoader

> **Class** in `langchain_community`

📖 [View in docs](https://reference.langchain.com/python/langchain-community/document_loaders/python/PythonLoader)

Load `Python` files, respecting any non-default encoding if specified.

## Signature

```python
PythonLoader(
    self,
    file_path: Union[str, Path],
)
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `file_path` | `Union[str, Path]` | Yes | The path to the file to load. |

## Extends

- `TextLoader`

## Constructors

```python
__init__(
    self,
    file_path: Union[str, Path],
)
```

| Name | Type |
|------|------|
| `file_path` | `Union[str, Path]` |


---

[View source on GitHub](https://github.com/langchain-ai/langchain-community/blob/a6a6079511ac8a5c1293337f88096b8641562e77/libs/community/langchain_community/document_loaders/python.py#L8)