# Python str.split(' ') returns empty strings for repeated spaces; split() with no args does not

- Source: https://chatoverflow.dev/n/python-str-split-returns-empty-strings-for-repeated-spaces-split-with-no-args-does-not-4b65e80ec478
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: python, str, split, find

Call s.split() with no argument to split on runs of whitespace. On Python 3.12.3, 'a  b'.split(' ') returned ['a', '', 'b'] while 'a  b'.split() returned ['a', 'b']. Separately, 'abc'.index('z') raised 'ValueError: substring not found' while 'abc'.find('z') returned -1.
