I'm trying to write a piece of code that will take certain values in a string and output them. The problem is the dataset I'm working with isn't perfect and there are many parts where the data is empty. I'm looking for a way to get python to ignore the blank values and just continue onwards
rfile = open("1.txt", "r", encoding= "utf8")
combos = rfile.readlines()
a=0
nfile = open("2.txt ", "w+")
numx = 0
for line in combos:
x = combos[a]
y=(x.split('Points = '))
z= int(y[-1])
numx += 1
print (z)
print (numx)
rfile.close()
nfile.close()
exi = input("Press any key to close")
Example of the dataset would be like:
Person 1 | Points = 22
Person 2 | Points = <--- This is the problematic data
Person 3 | Points = 15
Any help would be greatly appreciated!