示例#1
0
#
# Author:      Philip Bowditch
#
# Created:     06/03/2012
# Copyright:   (c) Philip Bowditch 2012
# Licence:     <your licence>
#-------------------------------------------------------------------------------

__author__ = "Philip Bowditch"

from Format.Formatter import Formatter

import pprint

# If present, use psyco to accelerate the program
try:    import psyco ; psyco.jit()
except: pass

class Python_Formatter(Formatter):
    """
    Formats any data tables into python format
    """

    def __init__(self, pretty = True):
        """
        Constructor for thee Python_Formatter class
        """
        Formatter.__init__(self)

        self.pretty = pretty
示例#2
0
#!/usr/bin/python
# -*- coding: iso-8859-1 -*-
# Hello, this program is written in Python - http://python.org
programname = "html2csv - version 2002-09-20 - http://sebsauvage.net"

import sys, getopt, os.path, glob, HTMLParser, re

try:
    import psyco

    psyco.jit()  # If present, use psyco to accelerate the program
except:
    pass


def usage(progname):
    """ Display program usage. """
    progname = os.path.split(progname)[1]
    if os.path.splitext(progname)[1] in [".py", ".pyc"]:
        progname = "python " + progname
    return """%s
A coarse HTML tables to CSV (Comma-Separated Values) converter.

Syntax    : %s source.html

Arguments : source.html is the HTML file you want to convert to CSV.
            By default, the file will be converted to csv with the same
            name and the csv extension (source.html -> source.csv)
            You can use * and ?.

Examples   : %s mypage.html
示例#3
0
文件: html2csv.py 项目: szqh97/test
#!/usr/bin/env python
# -*- coding: utf8 -*-
programname = 'html2csv - version 2002-09-20 - http://sebsauvage.net'
import sys, getopt, os.path, glob, HTMLParser, re
 
try:    import psyco ; psyco.jit()  # If present, use psyco to accelerate the program
except: pass
 
def usage(progname):
    ''' Display program usage. '''
    progname = os.path.split(progname)[1]
    if os.path.splitext(progname)[1] in ['.py','.pyc']: progname = 'python '+progname
    return '''%s
A coarse HTML tables to CSV (Comma-Separated Values) converter.
 
Syntax    : %s source.html
 
Arguments : source.html is the HTML file you want to convert to CSV.
            By default, the file will be converted to csv with the same
            name and the csv extension (source.html -> source.csv)
            You can use * and ?.
 
Examples   : %s mypage.html
           : %s *.html
 
This program is public domain.
Author : Sebastien SAUVAGE <sebsauvage at sebsauvage dot net>
         http://sebsauvage.net
''' % (programname, progname, progname, progname)
 
class html2csv(HTMLParser.HTMLParser):
示例#4
0
    else:
        return Ident2

def Func2(StrParI1, StrParI2):
    IntLoc = 1
    while IntLoc <= 1:
        if Func1(StrParI1[IntLoc], StrParI2[IntLoc+1]) == Ident1:
            CharLoc = 'A'
            IntLoc = IntLoc + 1
    if CharLoc >= 'W' and CharLoc <= 'Z':
        IntLoc = 7
    if CharLoc == 'X':
        return TRUE
    else:
        if StrParI1 > StrParI2:
            IntLoc = IntLoc + 7
            return TRUE
        else:
            return FALSE

def Func3(EnumParIn):
    EnumLoc = EnumParIn
    if EnumLoc == Ident3: return TRUE
    return FALSE

if __name__ == '__main__':
    import psyco
    psyco.jit(1)
    main()
    psyco.dumpcodebuf()