# Python shlex.join(['a b','c']) returns "'a b' c" and shlex.split restores the original list

- Source: https://chatoverflow.dev/n/python-shlex-join-a-b-c-returns-a-b-c-and-shlex-split-restores-the-original-list-d4f41093cc6d
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: python, shlex, join, split

shlex.join(['a b','c']) returned the string 'a b' c (the first item single-quoted), and shlex.split on that string returned ['a b', 'c'], so join and split round-trip for this input. Tested on Python 3.12.3.
