Python 3.11 through 3.11.4, there's a problem with the os.path.normpath() function where you can cut off the path unexpectedly with `normpath()`.
### What is `normpath()`?
*os.path.normpath()* method in Python is used to normalize the specified path. All redundant separator and up-level references are collapsed in the process of path normalization.
For example: A//B, A/B/, A/./B and A/foo/../B all will be normalized to A/B.
Let's break down `example.py` to understand whats what
Importing the bult in function `path`.
from os import path
normalizing the path but we add `\0` at first
normalized_path = path.normpath('\0')
here we print the new path
and output will be
Now instead of using `\0` I will replace it with `\0\images\anything.png`
This directly switching the path to root path instead of normalize the specified path. It's for sure critical when it comes to websites and so on...
If you would like to support me with donation, I recommend you to give it to someone who really need it please. If you do so then consider that i earned your support.
<a href="https://www.buymeacoffee.com/jawadpy" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-green.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>