So setzen Sie Konditionstasten in Python

apple = 'green'
orange = None
params = urllib.urlencode({
    'apple': apple,
    **({ 'orange': orange } if orange else {})
})
Salo Hopeless