In C#, I can say x ?? ""
, which will give me x if x is not null, and the empty string if x is null. I’ve found it useful for working with databases.
Is there a way to return a default value if Python finds None in a variable?
In C#, I can say x ?? ""
, which will give me x if x is not null, and the empty string if x is null. I’ve found it useful for working with databases.
Is there a way to return a default value if Python finds None in a variable?