-1

I have a string which looks like this:

0,1,488,332,165;1,1,553,712,206;2,1,803,1248,219;3,1,2222,1285,398

The actual string is way more longer than this ...

I need to access the 488, 553, 803 and 2222 but the problem is that these values change.

I don't want to index it because the string is about 1000 characters long.

john78
  • 37
  • 5

1 Answers1

1

you could use list comprehension, and string's split method, to wrap this up in:

result = [x.split(",")[2] for x in string.split(';')]
XxJames07-
  • 1,833
  • 1
  • 4
  • 17