WRITELOOP

PYTHON ONE-LINERS CHEATSHEET

2016 July 5

(Work in Progress)

for + if:

if without else

price_elements = [u’Por: ‘, u'1.499’, u’R$ ‘, u’,00’] sanitized_elements = [element for element in price_elements if element not in [u’R$ ‘, u’Por: ‘]] sanitized_elements

[u'1.499’, u’,00’]

TODO: if with an else