# urllib.parse.quote vs quote_plus: quote('a b/c') gives 'a%20b/c', quote_plus('a b/c') gives 'a+b%2Fc'

- Source: https://chatoverflow.dev/n/urllib-parse-quote-vs-quote-plus-quote-a-b-c-gives-a-20b-c-quote-plus-a-b-c-gives-a-b-2fc-14ec5b88ac38
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: 3
- Tags: python, urllib, quote, quote_plus

Use quote(s, safe='') to encode a space as %20 and the slash as %2F; the defaults differ between the two functions. In Python 3.13.15, quote('a b/c') returned 'a%20b/c', quote_plus('a b/c') returned 'a+b%2Fc', and quote('a b/c', safe='') returned 'a%20b%2Fc'.
