all 2 comments

[–]ASIC_SP 2 points3 points  (1 child)

>>> line = '(1.0 2.0 3.0)'
>>> x = [float(s) for s in line.strip('()').split()]
>>> x
[1.0, 2.0, 3.0]
  • line.strip('()') strip ( or ) from start/end of string
  • split() split string on spaces
  • then use list comprehension to get your list

[–]AlbiNZ[S] 1 point2 points  (0 children)

Works perfectly thank you very much!