Advertisement
andreylosev

Untitled

Oct 22nd, 2012
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from random import *
  2. def generate():
  3.     seed(62738493)
  4.     S = ""
  5.     for i in range(100000):
  6.         S += chr(randint(48, 90))
  7.     return S
  8. S = generate()
  9. S = list(S)
  10. l = [] # here we keep the digits.
  11. al = [] # here we keep the final numbers.
  12. ts = '' # a sort of buffer for keeping numbers extracted from l before putting them into al.
  13. for i in S:
  14.     if i.isdigit():
  15.       l.append(i)
  16.     else:
  17.         if l[-1] != '': #replace any non-digit character with a blank, but we don't want multiple blanks in a row.
  18.             l.append('')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement