Let's say I have a txt file like such:
I am a Noob:10
You are a Noob:20
He is a Noob:30
What I want to do is get the number after the : for a specific string, let's say for "You are a Noob" without having to know the position that this line is in.
I've found part of the solution in order to find the desired line, like so:
iamnoob = input('You are a Noob')
myFile = open(path).readline()
for line in myFile:
if iamnoob == line[0]:
two_parts = line.split(':')[-1]
print(two_parts)
but I am stuck in how to split it and get the part that I want. Thank you in advance for your assistance.
edit: I only want to keep the number after the split, not the whole line.