Python passing variable in a function -


so trying pass x test() rfid() tested , wont work:

this have:

def test(x):         testcard = 8974         x=testcard         return x   def rfid():         #this see if rfid chip has enough digits          main= 8974          # looks see if rfid chip has enough digits pass test          if main == x:                 print ("card read check complete")                 cardlength= info[main + readlen]                 main += readlen + 1                 return true,info[main:main + cardlength]         else:                         main += readlen + 1         return false,0,''   def main():         rfid(x)  main() 

first, have fix this:

def rfid(x):     # ... rest of code 

you see, if function needs parameter must declared such. next, have call rfid() test():

def test():         x = 8974         return rfid(x) 

and in main(), call test(). or call test(), there's no need declare , call main():

def main():         test()  main() 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -