python - ValueError:invalid literal for int() with base 10:' ' -


I get this error in Python.

I am reading from a text file, try to convert it to a variable and integer by adding value to it. This is my code

  fo = open ("HCTC3152_INF TXT "," r ") line1 = fo.readline ()  

Part of the middle 52:56 year is always like 2013 or 2014

  ChangeOperastStartdivaty YY = Intestine (Line 2 [52:56], 10) Change PrintOverStartDeti YY  

Then, always print out the years in the command prompt, and finally see the error. TI.

got you

exclude those lines:

  If not line.strip, then an empty line or at least one line  less  than 52 characters.  

():

To leave empty lines (only for white space), or for a minimal length test:

 < Code> if len (line)> = 56:  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -