Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to set conditionlally keys in python

apple = 'green'
orange = None
params = urllib.urlencode({
    'apple': apple,
    **({ 'orange': orange } if orange else {})
})
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #set #conditionlally #keys #python
ADD COMMENT
Topic
Name
7+6 =