Shell text to python string
===

I'm writing a little python utility to help move our shell -help documentation to searchable webpages, but I hit a weird block :


    output = subprocess.Popen([sys.argv[1], '--help'],stdout=subprocess.PIPE).communicate()[0]
    output = output.split('\n')
    print output[4]
    #NAME
    for l in output[4]:
        print l
    #N
    #A
    #
    #A
    #M
    #
    #M
    #E
    #
    #E
    
    #or when written, n?na?am?me?e

It does this for any heading/subheading in the documentation, which makes it near unusable.


Any tips on getting correct formatting? Where did I screw up?

Thanks