-3

I was searching a long time on stackoverflow - but nothing helped.

OK, i have extracted a string, wich looks like this:

e = ['[23,99.3],[1,99.6],[3,99.5]']

When i say e[0] is becomes a very nice array of lists

e = e[0]
e= [23,99.3],[1,99.6],[3,99.5]

But when i now try to access the data it only splits into numbers/chars. like this:

[
2
3
...

I tried yet: enumerate, ast, for loops and many things more - think ast might be a cool solution but not sure yet.

Thanks

Tonnbo
  • 3
  • 5

1 Answers1

-1

If you have: e = ['[23,99.3],[1,99.6],[3,99.5]'] is not a list of lists. Is a single string inside a one length list.

e[0] is the string, so when you slice over the string you get the single characters.

EDIT

Wrong sentence removed, please refer to the duplicate question to know how to split the string in a list.

Valentino
  • 7,291
  • 6
  • 18
  • 34