I am trying to check the equality of two strings however it seems that my code it doesnt work properly:
listes = []
for row in my_lines:
split = re.split(r' +', row)
print split[0], ":size of the split: ", len(split)
if str(split[0]) == '5':
print "...."
The printed message from my print before the if statement is the following:
'5' :size of the split: 3
'4' :size of the split: 4
'6' :size of the split: 3
'6' :size of the split: 4
'F' :size of the split: 4
'6' :size of the split: 4
'F' :size of the split: 4
'6' :size of the split: 4
However the if statement does not work. What could have been wrong here?
split[x]contains a string of the form"'x'", but you're only comparing it to"x".'5'with single quotation marks and space.