samedi 28 février 2015

Python3 .format() align usage

Can anyone help me to change the writing of these lines? I want to get my code to be more elegant using .format(), but I don't really know how to use it.


print("%3s %-20s %12s" %("Id", "State", "Population"))


print("%3d %-20s %12d" % (state["id"], state["name"], state["population"]))


Aucun commentaire:

Enregistrer un commentaire