User:Benc/Scripts/section reverser.py


 * 1) section_reverser.py
 * 2) Author: Benc
 * 3) Purpose: quick hack to reverse a long list of sections.
 * 4)          DOES NOT WORK IF THERE ARE SUBSECTIONS!

txt="""
 * 1) Below: cut and paste the page source that you want reversed.

"""

txt = string.strip(txt).split('==')
 * 1) Remove leading and trailing whitespace; change to array by '=='

heading = None result = [] for cur in txt: if heading == None: heading = cur else: result.append('==' + heading + '==' + cur) heading = None

result.reverse
 * 1) result = result[:10] # uncomment this line if you only first 10

for section in result: print section,