================================================================================
  ASV 0.3   1 March 2001   Copyright (c)2001 Laurence Tratt   laurie@tratt.net
================================================================================



   Introduction
  ==============

This is the first public release of ASV, my replacement module for my own surprisingly popular CSV.py. ASV is intended to be more feature rich, better designed and reliable. As this is the first public release there may well be bugs to be found.

ASV is distributed under a BSD style licence.


New versions of ASV will become available from:

  http://tratt.net/~laurie/python/asv/
  
Please mail me with any comments you might have at laurie@tratt.net.



   Features
  ==========

ASV features include:

* Format dependant input / output
* Extendable input / output scheme
* Built in input routines possess `good enough' heuristics to parse even badly
    formed files



   Installation
  ==============

Copy ASV.py into your Python path, preferably into the site-packages directory.



   Useage
  ========

ASV.py has doc strings for all the important `public' methods. This section is intended as an overview of how ASV works.

The ASV class - which implements all applicable list methods to appear to be a Python list - inside the ASV module holds 0 or more rows of data (stored in the format of the Row class) but has no concept of how this data has been input or how it will be output. In other words it simply stores data, converting it into and out of its internal format transparently when you make a call on it.

When you wish to input or output data, you have to give it a "helper" class instance which understands the physical representation of the data. To input from a file:

    # Import the ASV module
    
    import ASV
    
    
    # Create a blank ASV instance
    
    my_data = ASV.ASV()
    
    # We are loading from a file called "test_data.csv"
    # We are using the CSV loader
    # The CSV file we are loading has column headings so that we can access data
    #   by name rather than number
    
    my_data.input_from_file("test_data.csv", ASV.CSV(), has_field_names = 1)
    
So now `my_data' will hold some rows of data (presuming test_data.csv wasn't blank). You can use `my_data' just like a normal Python list:

    # Iterate over every row in my_data

    for row in my_data:
        # Print the row out - this gives us back an instance of the Row class
        
        print row
        
        # Print out a single element from the row
        
        print row[1]
        
        # Because our input file had field names, we can print out a named
        #   element in the row without having to know what its index is
        
        print row["address"]
    
    # Add a row to the end of `my_data'
    
    my_data.append(["Laurie", "England"])
    
    # Print out the row we just added
    
    print my_data[-1]

If having done all that, you want to save the data out as a TSV file just do:

    my_data.output_to_file("test_data_out.tsv", ASV.TSV())

If you wanted to just view the TSV output rather than saving it, then you can use the output method which just returns a string (input_from_file is similarly matched by input):

    print my_data.output(ASV.TSV())
