python入门(1)-初体验

买了kindle4,最近想做一个对雷锋网进行解析的工具。选用py。只好从头学习。

#

# @author:  xiaoyang

# @contact: [email protected]

# @version:

# @describ: 

# @log:

#           1.2012-11-19 create

#

import sys



class HelpDoc:

    def __init__(self):

        self.modHelp=[]

        self.modName=[]

    def show(self,index):

        if(index>=len(self.modName)):

            return

        print("%d.%s\t%s\r\n" %(index,self.modName[index],self.modHelp[index]))

    def showAll(self):

        index=0

        while (index<len(self.modName)):

            self.show(index)

            index=index+1

    def addModDoc(self,modName,modHelp):

        self.modName.append(modName)

        self.modHelp.append(modHelp)



def printTips():

    print "\

        Usage: thingy [OPTIONS]\r\n\

        -h                        Display this usage message\r\n\

    \r\n"





def main():

    sysDoc=HelpDoc()

    sysDoc.addModDoc("help","show help message.\r\n")

    sysDoc.showAll()

    print "bye~\r\n"

    return



#    

# @des: entry

#

main()

 

你可能感兴趣的:(python)