if statement - if variable is assigned then check some condition in python -
I'm coding in Python My problem is that I have a variable I get an error in the code given above Say this The variable SRRDAD is reaching before its assignment. is defined and if it then checks the position: PS: this is just code To minimize and make it intelligent, I know that if I can write longer in check, the code is, therefore the purpose of asking for it is not objective. Explanation: If you want to suggest the answer, where you have provided strig = nobody and then check it in another IUP loop, I want to execute. Print is printed even when no one That is why I am searching for a wise way to define if the condition. That is, I want to execute the print if struda = none or if there is no struda and the row Address (strGUID) == - 1 Edit: Basically my current code is the second in the form of a loop: I want to test whether it is an intelligent way of shortening it is. The customary way to do this would be to initially set if The first part ( strGUID in the function And then if there is a control flow in which I want to see that the variable is specified and if yes, then check it on some condition. The clear sample of code is as follows: for the row in the
list : if line.find ('project')! = - 1 strGUID = line.split (',') [2]. Strip ('' ') if flags == wrong and line Address (strGUID) == - 1: print 'written line:', line
line.find (strGUID) == - 1 . Such a thing
if flag == incorrect and (if strGUID again line.find (strGUID) == - 1):
if flag == incorrect and (struda No one is there (or struda no and line. Address (strGUID) == - 1)):
strGUID = none And then check
if flag == incorrect and (struda none and line.field (strGUID) == -1):
none of the synthesis ) is incorrect, the second part (
line.find (strGUID) == -1 ) will never be evaluated.
Comments
Post a Comment