Products Resources Support About Us

Rocket Software

Extract TM on u2py

Hi,

How can I extract TextMark value using u2py?

I got the values of a SVM with this sentence:
total = s.args[0].extract(6,1,7).dcount(u2py.TM)

But when I try to extract the info I got an error because the function only take 3 arguments:
for x in range(1,total):
print (s.args[0].extract(6,1,7,x))
‘’’
Traceback (most recent call last):
File “test.py”, line 46, in
print (s.args[0].extract(6,1,7,1))
File “/dasm/bin/u2py.py”, line 163, in extract
return DynArray(super().extract(*args, **kwargs))
TypeError: function takes at most 3 arguments (4 given)
‘’’
Does anyone knows how can I get the TM value in my for loop?
I apreciate your comments.
Regards,
DASM

There are a few ways, this works:
python> import u2py

python> rec = [ 1, 2, 3, 4, 5, [ [ “s1”, “s2”, “s3”, “s4”, “s5”, “s6”, [ “s7t1”, “s7t2” ], “s8” ]], 7 ]

python> dyn = u2py.DynArray( rec )

python> dyn

<u2py.DynArray value=b’1\xfe2\xfe3\xfe4\xfe5\xfes1\xfcs2\xfcs3\xfcs4\xfcs5\xfcs6\xfcs7t1\xfbs7t2\xfcs8\xfe7’>

python> stuff = dyn.extract(6,1,7)

python> for each_text, delim in stuff:

… print(each_text)

s7t1

s7t2