Which fix removes the bug?
import os
path = os.path.join('/data', '/logs')
print(path)
- Drop the second leading slash
- Use string concatenation
- Call os.path.abspath first
- Swap the two arguments
An absolute component discards everything before it, so the result is just '/logs'.
Play Problem Solving ▸