[?] Edit list structure?

Hi All,

I have a list that looks like this:

{{0, {0.}[0]}, {1, {309.56}[1]}, {2, {123.06}[2]}, {3, {-302.53}[3]}, {4, {-136.92}[4]}}

I want it to look like this:

{{0, 0}, {1, 309.56}, {2, 123.06}, {3, -302.53}, {4, -136.92}}

Can I get some advice?

thanks,
Whiffy

I suppose that there is a problem with the code that generates that list, but here is how you can clean it up:

{#[[1]], #[[2, 0, 1]]} & /@ 
{{0, {0.}[0]}, {1, {309.56}[1]}, {2, {123.06}[2]}, {3, {-302.53}[3]}, {4, {-136.92}[4]}}

Cheers,

Marco

Hey Marco, that’s like magic. Thanks.

Using ReplaceAll

{{0, {0.}[0]}, {1, {309.56}[1]}, {2, {123.06}[2]}, {3, {-302.53}[3]}, {4, {-136.92}[4]}} /.
 {a_, {b_}[_]} :> {a, b}

(* {{0, 0.}, {1, 309.56}, {2, 123.06}, {3, -302.53}, {4, -136.92}} *)