Getting nameerror in python -


i have following function, want concat 2 strings, wrong doing here?

commands = ["abcd","123"]  def configure_dev(self, steps):     func_name = self.id + ':configure dev'      global conf_cmd     key in commands:         conf_cmd += key + '\n'     print(conf_cmd) 

getting following error:

conf_cmd += key + '\n'

after running it, error: nameerror: name 'conf_cmd' not defined

i added code critical issue resolved.

commands = ["abcd","123"] def configure_dev(self, steps):   func_name = self.id + ':configure dev'   global conf_cmd = ''  //  <-- ''   key in commands:     conf_cmd+=key+'\n'   print(conf_cmd) 

Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -