How to split a string based on Split Strings based on White spaces, new lines, and tab spaces and store them in a list in Python?
            Asked
            
        
        
            Active
            
        
            Viewed 132 times
        
    -3
            
            
        - 
                    1Possible duplicate of [Most elegant way to split a string?](https://stackoverflow.com/questions/236129/most-elegant-way-to-split-a-string) – crenshaw-dev Sep 26 '17 at 23:11
- 
                    @mac9416 that's for a totally different language (C++) – John Szakmeister Sep 26 '17 at 23:13
- 
                    @jszakmeister awk, good point. – crenshaw-dev Sep 26 '17 at 23:13
- 
                    1Possible duplicate of [Split string on whitespace in Python](https://stackoverflow.com/questions/8113782/split-string-on-whitespace-in-python) – John Szakmeister Sep 26 '17 at 23:14
- 
                    Possible duplicate of [Split a string with unknown number of spaces as separator in Python](https://stackoverflow.com/questions/4309684/split-a-string-with-unknown-number-of-spaces-as-separator-in-python) – eyllanesc Sep 26 '17 at 23:15
1 Answers
3
            
            
        I think what you want here is the .split() method on strings
>>> s = 'one two\tthree\nfour'
>>> s.split()
['one', 'two', 'three', 'four']
 
    
    
        John Szakmeister
        
- 44,691
- 9
- 89
- 79
