Note that there are some explanatory texts on larger screens.

plurals
  1. POhow fetchall sqlite3 data into pretytable printing in python
    primarykey
    data
    text
    <p>i am new in python so far i need help for this output from sqlite3</p> <pre><code>(u'GABRIELLA TEGGIA (40)', u'-', u'65') (u'PUTRA', u'DPS', u'11') (u'SUASTINI', u'-', u'-') (u'ARI UTAMA', u'JL.D.BERATAN GG.8/4', u'26') (u'SUYASA', u'DS.TUNJUK,TABANAN', u'33') (u'SARAH(41)', u'BEJI AYU', u'40') (u'AA.GDE OKA', u'JL.H.WURUK 179 DPS', u'53') (u'AYU NILA RADIASTUTI', u'ABIAN BASE,KAPAL', u'8') (u'DANTI I NYOMAN', u'GIANYAR', u'50') (u'INDAYANI', u'BUNUTIN,UBUD', u'6') (u'JENNI', u'JL.MUTIARA NO.18 KEROBOKAN', u'37') (u'JERRY G.J ABELL', u'HOLLAND', u'-') (u'COK ALIT', u'BR.MUKTI,SINGAPADU', u'35') (u'SUPARTI NI PUTU', u'KARANGASEM', u'51') (u'SUMADA I GD', u'SINGARAJA', u'60') </code></pre> <p>but i can only fetch only the last row like this one</p> <pre><code>+-------------+-----------+------+ | Pasien | Alamat | Umur | +-------------+-----------+------+ | SUMADA I GD | SINGARAJA | 60 | +-------------+-----------+------+ </code></pre> <p>how to get the complete rows to print? I provide with my code here:</p> <pre><code>import sqlite3 connection = sqlite3.connect('data.db3') cursor=connection.cursor() print("Show data row by row:") print('-'*40) from prettytable import PrettyTable x = PrettyTable() x.set_field_names(["Pasien", "Alamat", "Umur"]) cursor.execute('SELECT nm_pasien, almt_pasien, umur_pasien from pasien limit 15') for nm_pasien in cursor: print nm_pasien print('-'*40) x.add_row(nm_pasien) x.printt() </code></pre> <p>I am using python 2.5 and pretytable module from <a href="http://code.google.com/p/prettytable/" rel="nofollow">here</a></p> <p>i am stuck please help. thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload