How to get part of a string up to a certain character in Python Use string.split() Use string.index()