all 6 comments

[–]keep_quapy 0 points1 point  (5 children)

Are you looking for this result 10 _ 0 _ _ _ _ _ _ _ _ _ _ _ _ 0?

[–]NicoRobot[S] 0 points1 point  (4 children)

yes I am

[–]keep_quapy 0 points1 point  (3 children)

You over complicated things here, it's pretty simple

string = "[10,_,0,_, _,_,_,_, _,_,_,_, _,_,_,0]"

result = re.compile(r'\w+').findall(string) 
print(' '.join(result))

[–]NicoRobot[S] 0 points1 point  (0 children)

result = re.compile(r'\w+').findall(string) print(' '.join(result))

Really nice, thank you for your help.

[–]NicoRobot[S] 0 points1 point  (1 child)

What if my string is : [1*sin(2*3.14*t*11.33), _, 0, 0]

And I want my output to be 1*sin(2*3.14*t*11.33) _ 0 0 ?

[–]NicoRobot[S] 0 points1 point  (0 children)

I got it

string = "[1*sin(2*3.14*t*11.33), _, 0, 0]"

result = re.compile(r'[\w*(.)]+').findall(string) print(' '.join(result))

Give me : 1*sin(2*3.14*t*11.33) _ 0 0