Python ASCII Reading tables
<p>I'm really sorry for asking probably silly question but I have spend half a day and could not find reasonable solution.
I have ASCII file:</p>

<pre><code>      "X"           "Z"             "Y"
   285807.2      -1671.056        2405.91
   285807.2      -1651.162       2394.932
   285807.2      -1631.269       2383.962
   285807.2      -1611.375       2372.988
   285807.2      -1591.481        2362.01
   285807.2      -1571.587       2351.01
</code></pre>

<p>.............................................
~1 000 000 rows</p>

<p>And I normaly read it:</p>

<pre><code>from astropy.io import ascii

data =ascii.read('C:\\Users\\Protoss\\Desktop\\Ishodnik1.dat')
print (data)
</code></pre>

<p>But How could I deal with columns? For instance sum each rows or make an average value,  etc only from columns Z and Y? As I understand I have to converts all my date to list of float valuse except for  headliner and then to write new ASCII file, doesn't it?</p>

<p>It's possible to treat the file as CSV and use <code>Sniffer</code> to autodetect the format:</p>

<pre><code>import csv

with open('C:\\Users\\Protoss\\Desktop\\Ishodnik1.dat', 'r') as f:
    # Sniff to autodetect the format
    dialect = csv.Sniffer().sniff(f.read(1024))
    f.seek(0)
    reader = csv.reader(f, dialect)

    # Read line by line and store as list of tuples
    data = []
    header = tuple(next(reader))
    for row in reader:
        data.append(tuple(row))
</code></pre>

python ascii