python - How do I get variables from a returned value within a function of a function? -


i put returned player sent message !player1 or !player2 short list can them later, can't seem find out how returned variables functions inside of functions. saw closure think following example can't seem returned values can assign them.

    def players(sender, event):      def getplayer():          msg = event.parsed[0]['msg']          if msg == '!player1':             botbasicfunction.sendmsg(msgg='{} has joined game!'.format(hasplayer()))             hasplayer()          if msg == '!player2':             botbasicfunction.sendmsg(msgg='{} has joined game!'.format(hasplayer()))             hasplayer()      def hasplayer():         invoker = event.parsed[0]['invokername']         return invoker      parsedmsg = event.parsed[0]['msg']      players = [getplayer(), getplayer(), getplayer(), getplayer()]      if parsedmsg == '!players':         botbasicfunction.sendmsg(msgg='{}'.format(players)) 


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -