-3

Could some one help me to fix a long question for me. I wanna split a long string into multiple sub-strings. Like this:

a= 1000 0.22222 aa bb 22 55 44 77 10 1.0
a1= 1000
a2= bb 22 55
a3= 77 10 1.0

Thank you in advance.

JuanPablo
  • 23,792
  • 39
  • 118
  • 164
  • have you tried anything yourself? Take a look at [split string into a list](https://stackoverflow.com/questions/743806/split-string-into-a-list-in-python) – LinkBerest Jul 04 '15 at 22:33
  • 2
    What exactly is the pattern you're trying to follow here? – Malik Brahimi Jul 04 '15 at 22:35
  • Thank all of you. In fact, I need a replace function for my script. Here,I just ask how to do split first. I have got the function by searching on stackoverflow. Thank you again. – user1730290 Jul 05 '15 at 00:08

1 Answers1

1
splited = a.split(' ')
print splited[0]
print splited[3:6]
print splited[-3:]

the output

http://testedanswers.com/questions/-JtQBz4MWfJYfmk00RZK

JuanPablo
  • 23,792
  • 39
  • 118
  • 164