Python HTTP Server: http.server, Ports, Directories, and Safety
Start Python’s local http.server, choose a port and directory, bind safely, write a small handler, and understand why it is not a production web server.
Browse Python tutorials for beginners and working developers, including syntax, libraries, examples, projects, and real problem-solving guides.
Start Python’s local http.server, choose a port and directory, bind safely, write a small handler, and understand why it is not a production web server.
Copy Python lists safely with slicing, list(), copy(), and deepcopy(), and understand shallow copies, nested mutability, aliases, and performance.
Combine Python strings with +, +=, join(), f-strings, StringIO, and templates while keeping types, separators, and encoding explicit.
Use Python’s ^ operator deliberately: bitwise XOR compares integer bits, while explicit boolean logic can make truth-value intent clearer.
Use Black with Git, pre-commit, pyproject.toml, GitHub Actions, VS Code, and Jupyter while keeping formatting reproducible.
Handle Python timezones with zoneinfo, aware datetimes, UTC storage, astimezone(), DST transitions, and safe formatting.
Encode fixed binary layouts with struct.pack(), decode with unpack(), and make byte order, sizes, ranges, and record length explicit.
Use OrderedDict when explicit reordering, endpoint popping, or order-sensitive equality matters, and compare it with modern dict behavior.
Use Python threading.Lock with context managers to protect shared state, avoid races, choose lock scope, and handle contention.
Use functools.wraps to preserve Python decorator metadata, __wrapped__, docstrings, annotations, and reliable introspection across stacked decorators.