Here is the thing: I'm getting very long hardcoded string and I have to check the length of this string using a conditional statement and if the statement is True
, I have to assign that string to variable
.
So, I'm going to achieve something like:
variable = 'VERY_LONG_STRING' if len('VERY_LONG_STRING') > 1000 else "TINY_STRING"
Is it even possible?
UPDATE I have to add some explanation - as you can see there is 'VERY_LONG_STRING' two times. And I would like to ask how to use it only once?
UPDATE2 It have to be one-liner.
PS It's for testing purpose only and I have to make it for many times. My script already contain a lot of variables and I'm almost lost in them. So, I would like to avoid some unnecessary use of temporary variables.