G
Gnarlodious
What is the best way to operate on a tuple of values transforming them against a tuple of operations? Result can be a list or tuple:
tup=(35, '34', 0, 1, 31, 0, '既濟')
from cgi import escape
[tup[0], "<span class='H'>{}</span>".format(tup[1]), bool(tup[2]), bool(tup[3]), tup[4], bool(tup[5]), escape(tup[6])]
-> [35, "<span class='H'>34</span>", False, True, 31, False, '&#26082;&#28639;']
But I want to loop rather than subscripting.
-- Gnarlie
tup=(35, '34', 0, 1, 31, 0, '既濟')
from cgi import escape
[tup[0], "<span class='H'>{}</span>".format(tup[1]), bool(tup[2]), bool(tup[3]), tup[4], bool(tup[5]), escape(tup[6])]
-> [35, "<span class='H'>34</span>", False, True, 31, False, '&#26082;&#28639;']
But I want to loop rather than subscripting.
-- Gnarlie