I'm trying to make a list such as this (it is not nested list its just seperate list):
[0,0]
[1,0]
[2,0]
The list must be separate from each other.
The elements of the list has to be integer and the value of the elements must be less than 10.
The element of the list comes from a file which looks like this:
0-0 (these are strings)
1-0
2-0
Here is my code:
with open(_file) as lines:
for line in lines:
for element in line.split():
s_lines = element.split('-')
for i in s_lines:
num = int(i)
print(s_lines)
this gives ['0','0'] ['1','0'] ['2','0'], and this doesnt allow me to verify that the value of the element in each list is less than 10
Can some please help me convert the elements of the list into an integer while keeping the format of 2 elements per list