The words Under construction in black text on a yellow background with diagonal black stipes surrounding it
I'm in the process of moving my site. It's still a work in progress. Please excuse the mess and broken links.

Join Strings In Python To Make A Path

TODO: Pull subtitle into page object
Code
import os.path

joined_path = os.path.join('a', 'b', 'c')

print(joined_path)
Results
a/b/c



This is useful in when you need a user's
home directory:
Code
import os.path
from pathlib import Path

joined_path = os.path.join(Path.home(), 'a', 'b', 'c')

print(joined_path)
Results
/Users/alan/a/b/c

Debugging Stuff

I'm moving stuff around right now. All this below is helping me figure out where to put stuff

        -- title

Join Strings In Python To Make A Path

This is the basic way to join strings into 
a file or directory path in python:

-- code
-- python

import os.path

joined_path = os.path.join('a', 'b', 'c')

print(joined_path)

-- results

a/b/c



This is useful in when you need a user's
home directory:


-- code
-- python

import os.path
from pathlib import Path

joined_path = os.path.join(Path.home(), 'a', 'b', 'c')

print(joined_path)

-- results

/Users/alan/a/b/c


-- categories
-- Python

-- blurb

Mushing directories together to make a Python path

-- metadata
-- date: 2022-03-07 18:11:10
-- id: 264tqbsl
-- site: aws
-- type: post
-- status: published