How to set the global variable so that it can be accessed and released inside other methods
rosuav at gmail.com
Thu Oct 2 17:34:29 CEST 2014
On Fri, Oct 3, 2014 at 1:29 AM, Milson Munakami <milsonmun at gmail.com> wrote:
> #I am trying to set net variable to global
> global net
> def CreateNet(self):
> "Create an empty network and add nodes to it."
> net = Mininet( controller=RemoteController )
You're almost there! All you have to do is move that global
declaration into CreateNet itself. That's the only place where it's
I'm not sure why you have a class that sets up a global, though. It
would be much more normal to use "self.net" everywhere instead.
More information about the Python-list