I am reading a simple text file that will contains three set of string values
as follow:
"1234567", "ABC123456" , ""
I have my codes as follow trying to check for an empty string, with the input string as above, I can never get it to display "testid is empty", Any idea why the test failed?:
as follow:
"1234567", "ABC123456" , ""
I have my codes as follow trying to check for an empty string, with the input string as above, I can never get it to display "testid is empty", Any idea why the test failed?:
Code:
FileData = open(filename, "r")
Filecontents = FileData.readline().strip()
FileData.close()
testid = FileContents.split(",")[2]
if (testid == ""):
print "testid is empty"
else:
print "testid has value"
Comment