Beispiel #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
Beispiel #2
0
#!/usr/bin/python
# -*- coding: UTF-8 -*-
programname = 'TwseIsinDownload - version 2013-04-15'

####################################################################
# Public Libary
####################################################################
import sys, getopt, os.path, glob, HTMLParser, re, html2csv, urllib

try:
    import psyco
    psyco.jit()
except:
    pass

####################################################################
# Private Libary
####################################################################
import html2csv


####################################################################
# TWSE ISIN and Quote index convert class
# From HTML file to CSV file
####################################################################
class TwseIsinSrc2Csv(html2csv.html2csv):

    #
    # Class initial function
    #
    def __init__(self):
Beispiel #3
0
#!/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):
Beispiel #4
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
           : %s *.html
Beispiel #5
0
#!/usr/bin/env python2
# -*- 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
           : %s *.html

This program is public domain.
Author : Sebastien SAUVAGE <sebsauvage at sebsauvage dot net>
         http://sebsauvage.net
''' % (programname, progname, progname, progname)
Beispiel #6
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
Beispiel #7
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()