# Python Tabnanny Module

The `tabnanny` module is intended to be called as a script to check Python source files for ambiguous indentation. It detects if a file mixes tabs and spaces in a way that depends on the tab width (which can be confusing or lead to `IndentationError`).

## Importing the Module

```python
import tabnanny
```

## Programmatic Usage

You can use `tabnanny.check()` to check a file or directory.

```python
import tabnanny

# Check a specific file
tabnanny.check("myscript.py")
```

If the file is clean, it produces no output. If there are issues, it prints them to stdout.

## Command Line Usage

The most common way to use `tabnanny` is from the command line.

```bash
python -m tabnanny myscript.py
```

To check an entire directory tree:

```bash
python -m tabnanny .
```

### Options

*   `-v`: Verbose mode. Prints a message for every file checked.
*   `-q`: Quiet mode. Suppresses output for clean files (default).

```bash
python -m tabnanny -v myscript.py
```

[[programming/python/python]]