I have a text file:
1 0 1 0 1 0
1 0 1 0 1 0
1 0 1 0 1 0
1 0 1 0 1 0
I want to be able to retrieve each string and convert it to an integer data type but my piece of code results in ValueError: invalid literal for int() with base 10: ''
tile_map = open('background_tiles.txt','r');
for line in tile_map:
for string in line:
self.type = int(string);
What is the correct way to retrieve the data and convert it successfully?