Formatting a column's value output
Michael Torrie
torriem at gmail.com
Sat Jan 26 17:26:44 EST 2013
On 01/26/2013 12:41 PM, Ferrous Cranus wrote:
> I can use triple (''') quoting so i dont have to escape special characters.
Hmm. I think you missed what he was getting at. He's not talking about
Python escape sequences. He's talking about HTML ones. There is a
function in one of the standard library modules that does this. I think
it's called html_sanitize or something. Google will find this.
> But i didnt understand you suggestion about the tuple.
What don't you understand about it? It's basic python string formatting
(well python 2.x string formatting).
http://docs.python.org/2/library/stdtypes.html#string-formatting-operations
A tuple is one method for passing variables into the string formatter.
So if you need to display something twice, just put in two "%s" in the
format string, and pass it the same variable twice.
> The dataset returns many lines and i need to transfor only the URL column....
> Sorry i did not understood.
More information about the Python-list
mailing list