Hey yury hows it going?
Python is fairly smart at figuring out if you want to do something
with a variable or not. I dont know if you know but you can use the if
statement very loosely. For example:
foo = None
# None = False
if(foo):
print 'yes';
>>
foo = []
# [] = False
if(foo):
print 'yes';
>>
foo = [1,2,3]
# [1,2, 3] == True
if(foo):
print 'yes';
>> yes
foo = 5
# 5 == True
if(foo):
print 'yes';
>> yes
foo = 'test'
# 'test' == True
if(foo):
print 'yes';
>> yes
foo = ''
# '' == False
if(foo):
print 'yes';
>> yes
On Feb 6, 1:25 pm, yury nedelin <[email protected]> wrote:
> let say
>
> mc.select(clear=1)
> print mc.ls(sl=1)
>
> >>None
>
> I have to check if its "None" or a list if I want to do a For loop anything
> else with the List
>
> Are there better ways than checking >> if "None" >> all the time ?
>
> Thanks
> Yury
--~--~---------~--~----~------------~-------~--~----~
Yours,
Maya-Python Club Team.
-~----------~----~----~----~------~----~------~--~---