Advertisement
here2share

# holy_macro.py <<< Quick Text List Editor

May 20th, 2015
356
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.58 KB | None | 0 0
  1. # holy_macro.py <<< Quick Text List Editor
  2.  
  3. aaa='''
  4. CCC
  5. AAA  $  $  $  $   one!
  6. $ $$ $$$$$$$$$$ $ two!
  7. 123 A B C X Y Z CCCCCC
  8.  
  9. AAA
  10. 123$ $ $ $ $ $ $ $ $ $
  11. $$$$$$$$$$$$$$$$$$$$$$
  12. CCCCC A A A A A ABBBBB
  13.  
  14. BBB
  15. AAA $ $$ $$$$ $$ zero!
  16. CCCCC A A A A A ABBBBB
  17. $$$$$$CCCCCCCCCCC12345
  18. '''
  19.  
  20. aaa=aaa.split('\n\n')
  21. while aaa[0].startswith('\n'):
  22.     aaa[0]=aaa[0][1:]
  23. aaa.sort()
  24. print 'samples = ['
  25. for i in aaa:
  26.     a,b=i.split('\n',1)
  27.     b=b.replace(' ','')
  28.     b=b.replace('$$$','')
  29.     b=b.split('\n')
  30.     b=''.join(b)
  31.     print '\t[  "'+unicode(a)+'",'
  32.     print "\t   '"+b+"' ],"
  33.     print
  34. print '\t]'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement