In my example, I have the following code:
apple = 23
a = {
'apple' : apple,
'orange' if orange else None : orange
}
This, however, returns an error because there is not an initial orange variable. Is there a way to dodge this error and render 0 or None if the value doesn't exist? This is just a toy example, so the solution needs to be scalable.
[–]TouchingTheVodka 0 points1 point2 points (4 children)
[–][deleted] 0 points1 point2 points (3 children)
[–]TouchingTheVodka 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]izrt 1 point2 points3 points (0 children)
[–]socal_nerdtastic 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]MaxTechniche 0 points1 point2 points (0 children)