I want to separate some words of a string but there is two types of divisions in the line using python: Example of the string:
add $s2, $s0, $s1
I want to separate in:
"add", "$s2", "$s0", "$s1"
but with data.split()
function I can only Split them with "," or " ", but in this case between add and $s2 it doesn't have "," only " ".
arq = open('entrada.asm', 'r')
text = arq.readlines()
for line in text:
(inst) = line.split(" ")
(reg1, reg2, reg3) = line.split(",")
print(inst, reg1, reg2, reg3)
arq.close()