I get to read a line from a file that contain certain set of numbers per line. My problem is that the input is from a string line and then I need to process it as integer, making the conversion as usually suggested. Although I check previous post on this problem, maybe because I am using structure and split can be the reason why the conversion is not working properly.
Here this error is popping up:
TypeError: not all arguments converted during string formatting
SyntaxError: invalid syntax
This is a snapshot from the code I have done so far:
class Data:
value1 = 0
max = 10
class Process:
value = None
def __init__(self):
self.input = Data()
def __del__(self):
self.input
def getValue(self,line):
counter=0
for word in line.split():
if counter == 0:
self.input.value1=(int)word
for number in self.input.max:
if (number % self.input.value1 ==0):
print(number)
def readingFile(self):
file = open(filename, "r")
for line in file:
self.getValue(line)
Any suggestion what might be missing? I am running on Linux Python 3 using command line to compile.