Find, split and concatenate
Question: I have to find certain supplier according number in the second line (17.
position)

For example , I have to find , split and concatenate this type of text - (The
specifier for find , split and concatenate is second line - NUMBER , which
consists from 6 numbers , so I have to find this number and concatenate
according this number)

Do I have to use some kind of regular expressions ? or only find,split and
concatenate ? (according numbers - 45107, 57107)

Output is also here:

    
    
    Add and Remove Platforms.
                 47107 Specify which Python runtime, CPython or Jython, to use as a
    Choose which CPython is used.
    
    
    
    Add and Remove Platforms.
                 47107 Specify which Python runtime, CPython or Jython, to use as a
    Choose which CPython is used.
    
    
    
    Add and Remove Platforms.
                 57107 Specify which Python runtime, CPython or Jython, to use as a
    Choose which CPython is used.
    
    
    
    Add and Remove Platforms.
                 47107 Specify which Python runtime, CPython or Jython, to use as a
    Choose which CPython is used.
    
    
    
    Add and Remove Platforms.
                 57107 Specify which Python runtime, CPython or Jython, to use as a
    Choose which CPython is used.
    

Output (after find , split and concatenate):

    
    
    Add and Remove Platforms.
                 47107 Specify which Python runtime, CPython or Jython, to use as a
    Choose which CPython is used.
    
    
    
    Add and Remove Platforms.
                 47107 Specify which Python runtime, CPython or Jython, to use as a
    Choose which CPython is used.
    
    
    
    Add and Remove Platforms.
                 47107 Specify which Python runtime, CPython or Jython, to use as a
    Choose which CPython is used.
    
    
    
    Add and Remove Platforms.
                 57107 Specify which Python runtime, CPython or Jython, to use as a
    Choose which CPython is used.
    
    
    
    Add and Remove Platforms.
                 57107 Specify which Python runtime, CPython or Jython, to use as a
    Choose which CPython is used.
    


Answer: You seem to want the output sorted by the number so you can use `re.split` and
sort with a `lambda` if all your output is as posted:

    
    
    s = """
    Add and Remove Platforms.
                 47107 Specify which Python runtime, CPython or Jython, to use as a
    Choose which CPython is used.
    Add and Remove Platforms.
                 47107 Specify which Python runtime, CPython or Jython, to use as a
    Choose which CPython is used.
    Add and Remove Platforms.
                 57107 Specify which Python runtime, CPython or Jython, to use as a
    Choose which CPython is used.
    Add and Remove Platforms.
                 47107 Specify which Python runtime, CPython or Jython, to use as a
    Choose which CPython is used.
    Add and Remove Platforms.
                 57107 Specify which Python runtime, CPython or Jython, to use as a
    Choose which CPython is used.
    """
    import re
    
    srt = sorted(re.split("(?<=which CPython is used.)\n",s),key=lambda x: re.findall("\d{5}",x))
    
    for line in srt:
       print line
    
    Add and Remove Platforms.
                 47107 Specify which Python runtime, CPython or Jython, to use as a
    Choose which CPython is used.
    Add and Remove Platforms.
                 47107 Specify which Python runtime, CPython or Jython, to use as a
    Choose which CPython is used.
    Add and Remove Platforms.
                 47107 Specify which Python runtime, CPython or Jython, to use as a
    Choose which CPython is used.
    Add and Remove Platforms.
                 57107 Specify which Python runtime, CPython or Jython, to use as a
    Choose which CPython is used.
    Add and Remove Platforms.
                 57107 Specify which Python runtime, CPython or Jython, to use as a
    Choose which CPython is used.
    

