Cycle through and compare a list with a variable



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 10/03/2011 at 22:18, xxxxxxxx wrote:

    Hi folks,

    I am sorry to ask so many basic stuff here but but the examples in the c4d world are stil scarce and the original python sdk is not as understandable as i wished.

    I want to cycle through and compare a list with a variable like.

      
    #pseudocode do not copy ;-)   
    variabletestme = 1.78   
    alist = (1.23323, 2.23432424, 4.34535, 1.78)   
      
    if variabletestme == isin(alist) :   
        go for it
    

    any idea?

    thanks in advance



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 10/03/2011 at 23:28, xxxxxxxx wrote:

    It's the best explained one I've ever seen.
    Python 2.7 Doc - Tutorial

      
    v = 1.78  
    lst = (1.231, 846, 1.78, 96513)  
      
    if v in lst:  
      print "v is in lst"
    

Log in to reply