partition, rpartition()

Both functions return a 3-tupel. rpartition uses the last occurence of the string to split it.

>>> "pre.test.fio".rpartition('.')[0]
'pre.test'
>>> "pre.test.fio".partition('.')[0]
'pre'