''' Pyblish - Python Publisher '''By the way this code has nothing to do with that web server and application framework hosted at sourceforge and called Pyblish too
''' Author: Tarek Amr '''
''' Version: 0.1'''
''' File: pyblish.py'''
''' Date: 07 Jan 2006 '''
import string, sys
if __name__ == "__main__":
[TAB]try:
[TAB][TAB]filein = sys.argv[2]
[TAB][TAB]mode = sys.argv[1]
[TAB]except:
[TAB][TAB]print "Usage: python pyblish [ --decode | --encode ] INPUT_FILE_NAME"
[TAB][TAB]sys.exit()
[TAB]if mode == "--decode":
[TAB][TAB]temp = filein.split(".")
[TAB][TAB]temp[-1] = ".txt"
[TAB][TAB]fileout = string.join(temp)
[TAB]elif mode == "--encode":[TAB]
[TAB][TAB]temp = filein.split(".")
[TAB][TAB]temp[-1] = ".py"
[TAB][TAB]fileout = string.join(temp)
[TAB]else:
[TAB][TAB]print "Usage: python pyblish [ --decode | --encode ] INPUT_FILE_NAME"
[TAB][TAB]sys.exit()
[TAB]fdin = open(filein,"r")
[TAB]fdout = open(fileout,"w")
[TAB]for line in fdin.readlines():
[TAB][TAB]if mode == "--decode":
[TAB][TAB][TAB]line = line.replace("\t","[TAB]")
[TAB][TAB]elif mode == "--encode":
[TAB][TAB][TAB]line = line.replace("[TAB]","\t")
[TAB][TAB]fdout.write(line)
[TAB]fdin.close()
[TAB]fdout.close()
Tags: Python, Blog, Gr33n Data
use drupal or a decent blogging tool. seebak men blogger ba2ah
ReplyDeleteEven if there are better blog hosting places, migration is not that easy
ReplyDeleteit is just ask alaa for help on that, he made a semi-automated process for that.
ReplyDelete