Skip to content

Instantly share code, notes, and snippets.

@KoaxialKable
Last active August 29, 2015 14:19
Show Gist options
  • Save KoaxialKable/2761845aaf82b4477cf9 to your computer and use it in GitHub Desktop.
Save KoaxialKable/2761845aaf82b4477cf9 to your computer and use it in GitHub Desktop.
Just a quick peek at some of the string formatting options available in Python.
for row in curs.fetchall():
print('{Name:<21} {Amount:>17,.2f} {AvgAmount:>18,.2f} {NumTimes:>12}'.format(
Name = row[0],
Amount = row[1],
AvgAmount = row[2],
NumTimes = row[3]
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment