Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 20 additions & 26 deletions docs/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
Tutorial
========

**This tutorial is distributed with PrettyTable and is meant to serve as
a "quick start" guide for the lazy or impatient. It is not an exhaustive
description of the whole API, and it is not guaranteed to be 100% up to
date. For more complete and update documentation, check the PrettyTable
wiki at http://code.google.com/p/prettytable/w/list**
**This tutorial is distributed with PrettyTable and is meant to
serve as a "quick start" guide. It is not an exhaustive description
API, and it is not guaranteed to be 100% up to of the whole
date. For more complete and update documentation, check the
PrettyTable wiki at http://code.google.com/p/prettytable/w/list**

Getting your data into (and out of) the table
=============================================
Expand Down Expand Up @@ -142,12 +142,6 @@ Printing

To print a table in ASCII form, you can just do this:

::

print x

in Python 2.x or:

::

print(x)
Expand Down Expand Up @@ -191,7 +185,7 @@ be printed:

::

print x.get_string(fields=["City name", "Population"])
print(x.get_string(fields=["City name", "Population"]))

gives:

Expand All @@ -217,7 +211,7 @@ to 1 (the first row is row 0, so the second is row 1) and set ``end`` to

::

print x.get_string(start=1,end=4)
print(x.get_string(start=1,end=4))

prints:

Expand Down Expand Up @@ -247,7 +241,7 @@ respectively:
::

x.align = "r"
print x
print(x)

gives:

Expand Down Expand Up @@ -278,7 +272,7 @@ were a dictionary.
x.align["Area"] = "c"
x.align["Population"] = "r"
x.align["Annual Rainfall"] = "c"
print x
print(x)

gives:

Expand Down Expand Up @@ -310,7 +304,7 @@ this:

::

print x.get_string(sortby="Population")
print(x.get_string(sortby="Population"))

to get

Expand All @@ -337,9 +331,9 @@ make the setting long term like this:
::

x.sortby = "Population"
print x
print x
print x
print(x)
print(x)
print(x)

All three tables printed by this code will be sorted by population (you
could do ``x.reversesort = True`` as well, if you wanted). The behaviour
Expand Down Expand Up @@ -382,7 +376,7 @@ table" feature:

from prettytable import MSWORD_FRIENDLY
x.set_style(MSWORD_FRIENDLY)
print x
print(x)

In addition to ``MSWORD_FRIENDLY`` there are currently two other
in-built styles you can use for your tables:
Expand Down Expand Up @@ -454,9 +448,9 @@ you can do this:
::

x.border = False
print x
print x
print x
print(x)
print(x)
print(x)

Neither of the 3 tables printed by this will have borders, even if you
do things like add extra rows inbetween them. The lack of borders will
Expand Down Expand Up @@ -494,9 +488,9 @@ could do this:

::

print x
print x.get_string(border=False)
print x
print(x)
print(x.get_string(border=False))
print(x)

Displaying your table in HTML form
==================================
Expand Down