Alright, I know how to print variables and strings. But how can I print something like "My string" card.price (it is my variable). I mean, here is my code: print "I have "
(and here I would like to print my variable card.price).
You can do it by your way but you are missing the order that is the only issue:
[unicode(x.strip()) if x is not None else '' for x in row]
[f(x) if condition else g(x) for x in sequence]
In list comprehension with if condition we can do like as follows:-
[f(x) for x in sequence if condition]
Another way of doing this is:-
def change(f): if f is None: return unicode(f.strip()) else: return '' row = [change(x) for x in row]
if f is None:
row = [change(x) for x in row]
You can also use the following way to solve the problem:-
row = map(change, row)