Skip to content

Instantly share code, notes, and snippets.

@oiuww09fn
Created September 24, 2013 02:10
Show Gist options
  • Save oiuww09fn/6679496 to your computer and use it in GitHub Desktop.
Save oiuww09fn/6679496 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
# export the book Learn Vimscript the Hard Way
# git clone https://github.com/sjl/learnvimscriptthehardway.git
# copy the file in learnvimscriptthehardway folder.
import os
ROOTPATH = os.path.dirname(__file__)
for i, j, k in os.walk(os.path.join(ROOTPATH, "chapters")):
books = k
books.sort()
final_book = open(os.path.join(ROOTPATH, "Vimscript.md"), "w")
for i in range(57):
txt = open(os.path.join(ROOTPATH, "chapters", books[i]), "r").readlines()
for k, j in enumerate(txt):
if k == 0:
j = "%s. %s" % (i, j)
final_book.write(j)
final_book.write("\n******************\n")
print "finish!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment