Skip to content

Instantly share code, notes, and snippets.

@pauleveritt
Created November 17, 2020 23:39
Show Gist options
  • Save pauleveritt/004db22d6af48e1be7662b742a65e54f to your computer and use it in GitHub Desktop.
Save pauleveritt/004db22d6af48e1be7662b742a65e54f to your computer and use it in GitHub Desktop.
How to re-parent an absolute path to be under a different root?
from pathlib import Path
def main():
icon = Path('/favicon.png')
static = Path('/static')
result = static / icon
print(str(result))
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment