python Programming Glossary: split_it
Python/Regex - Match .#,#. in String http://stackoverflow.com/questions/12608152/python-regex-match-in-string to perform the split as you want it import re def split_it s pieces re.split r' . d d . ' s pieces 1 pieces 1 .rsplit '.'.. '.' 1 # split off extension return pieces Testing print split_it 'Test1.0 0.csv' 'Test1' '0 0' 'csv' print split_it 'Test2.wma'.. print split_it 'Test1.0 0.csv' 'Test1' '0 0' 'csv' print split_it 'Test2.wma' 'Test2' 'wma' print split_it 'Test3.1100 456.jpg'..
|