I would like to extract an integer(30) from a tuple list as shown below which comes after the set "vertices". The code has to have some logic to look for after vertices.
(mdb.models['model-3'].rootAssembly.instances['Circular_knit - 2, 3, 3-1'].vertices[30], (-3.61088101472848e-14, 5.0, -3.95139073393513e-16))
I found examples to extract this integer when the tuple is comprising only in integers. My case here is that it is after a specific set of character("vertices") that I want to extarct the integer value('30').
I would appreciate any advise on this.
>>>v
[mdb.models['model-3'].rootAssembly.instances['Circular_knit - 2, 3, 3-1'].vertices[30], (-3.61088101472848e-14, 5.0, -3.95139073393513e-16)]
>>> v[0]
mdb.models['model-3'].rootAssembly.instances['Circular_knit - 2, 3, 3-1'].vertices[30]
k=v[0]
k=str(k)
>>> i=0
>>> num_list = [int(i.split('[')[1]) for i in k]
IndexError: list index out of range
question from:
https://stackoverflow.com/questions/66051460/extracting-integer-from-a-tuple-list-containing-a-mix-of-characters-and-integers 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…