LOADING DATA INTO ARRAYS

Skip Montanaro skip at pobox.com
Thu Jul 10 09:58:19 EDT 2003


    Jiri> Because if the line is '123   456 789', then line.split() is
    Jiri> ['123', '', '', '456', '789']

Nope:

    % python
    Python 2.2.3 (#1, Jun 21 2003, 08:08:22) 
    [GCC 3.0.1] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> line = '123   456 789'
    >>> line.split()
    ['123', '456', '789']
    >>> line.split(" ")
    ['123', '', '', '456', '789']

line.split() is not line.split(" ").

Skip





More information about the Python-list mailing list