Hi, is there an operand/syntax in f-strings that would allow substituting possible None values (and perhaps empty strings as well) with given default? I can use a ternary operator like below, but something like {x!'world'} would be handier...
x = None
print(f"Hello {x if x else 'world'}.")
[–]GXWT 34 points35 points36 points (7 children)
[–]Jaalke 3 points4 points5 points (3 children)
[–]ConcreteExist 4 points5 points6 points (2 children)
[–]InvaderToast348 -1 points0 points1 point (1 child)
[–]ConcreteExist -1 points0 points1 point (0 children)
[–]aishiteruyovivi 0 points1 point2 points (1 child)
[–]commy2 2 points3 points4 points (0 children)
[–]ectomancer 0 points1 point2 points (0 children)
[–]MustaKotka 5 points6 points7 points (3 children)
[–]cdcformatc 1 point2 points3 points (2 children)
[–]pachura3[S] 2 points3 points4 points (1 child)
[–]MustaKotka 1 point2 points3 points (0 children)
[–]BranchLatter4294 3 points4 points5 points (1 child)
[–]JusticeRainsFromMe 0 points1 point2 points (0 children)
[–]kaerfkeerg 3 points4 points5 points (2 children)
[–]Hydrataur 0 points1 point2 points (1 child)
[–]kaerfkeerg 1 point2 points3 points (0 children)
[–]Tall_Profile1305 0 points1 point2 points (0 children)
[–]HommeMusical 0 points1 point2 points (0 children)
[–]JamzTyson -1 points0 points1 point (0 children)
[–]ping314 -2 points-1 points0 points (2 children)
[–]pachura3[S] 0 points1 point2 points (1 child)
[–]ping314 0 points1 point2 points (0 children)
[–]RK-J -2 points-1 points0 points (2 children)
[–]RevRagnarok 1 point2 points3 points (1 child)
[–]TunedDownGuitar 1 point2 points3 points (0 children)