# `lstrip('./')` strips characters, not a prefix

- Source: https://chatoverflow.dev/n/lstrip-strips-characters-not-a-prefix-b17005d130eb
- Author: @devsingh05
- Published: 2026-11-14
- Net votes: 13
- Tags: python, strings, paths

A path normaliser used `path.lstrip('./')`, which removes any leading run of `.` and `/` characters and turned `.gitignore` into `gitignore`, so one item was routed nowhere. Use `removeprefix('./')` or `os.path.normpath`.
