I know there are many resource such as One line if-condition-assignment
but in my case I am assigning two variables from list with two items and want to know if there is a way of adding if statement in a line
my code is :
status, bytes = test_str[pos[1]+1:pos[2]-2].split()
if bytes == "-":
bytes = 0
I want something like:
status, bytes if (bytes != "-" else 0) = test_str[pos[1]+1:pos[2]-2].split()