I would like to exclude substring starting from '>' and closing with ' '.
content = "classTest>528 points"
substring = content['>' : ' ']
print substring # 528
If you do not want to use regular expressions (which has a bit of a learning curve), you can use this simpler but longer code.
content = "classTest>528 points" i = content.find('>') j = content.find(' ', i+1) substring = content[i+1:j] print(substring)