Not all languages use spaces between words; the ancient Latin and Greek did not. Spaces were not used to separate words until roughly 600-800 AD. (See interword separation for more on the history.) Traditionally, all CJK languages have no space: modern Chinese and Japanese still don't, but modern Korean uses space.
In programming language syntax, spaces are frequently used to explicitly separate tokens. Aside from this use, spaces and other whitespace are usually ignored by most modern programming languages; Python is one exception.
In word processors and text editorss, if a line on a screen is shorter than the width of the screen or window, then the empty space to the right usually does not correspond with space characters in the file: there is simply a code indicating that the next text should be put on a new line. Thus, the size of the file is not made unnecessarily larger. If there are space characters, one usually does not see the difference; text editors and word processors often have an option to make them visible. Also, if there is a space character, the cursor can move there, otherwise usually not.