# datetime, os & sys — Python

Source: https://www.geekswithgeeks.com/en/python/py-datetime-os-sys

> Work with dates and times, and talk to the operating system.

## datetime basics

`datetime` handles dates, times and the difference between two moments.

```python
from datetime import datetime, timedelta

now = datetime.now()
print(now.strftime("%Y-%m-%d %H:%M"))
tomorrow = now + timedelta(days=1)
print(tomorrow.date())
```

## os & sys

`os` interacts with the filesystem and environment; `sys` exposes interpreter-level details like command-line arguments.

```python
import os, sys

print(os.getcwd())               # current working directory
print(os.listdir("."))           # files in this folder
print(sys.argv)                  # command-line arguments
print(sys.version_info)          # interpreter version
```
