I have file that contains values separated by tab (\"\\t\"). I am trying to create a list and store all values of file in the list. But I get some problem. Here is my code.<
An other regex-based solution:
regex
>>> strs = "foo\tbar\t\tspam" >>> r = re.compile(r'([^\t]*)\t*') >>> r.findall(strs)[:-1] ['foo', 'bar', 'spam']