0

I would like to save an array (please see example bellow) to another file with using write-core function

HERE_MY_ARRAY = [0.01,0.02,0.4]

attribute - for example: reject_request, open_session etc.

  f = open("methods.py", "w")
  f.write('''\
def %s(self):
        \tyield self.env.timeout(random.choice(HERE_MY_ARRAY))
    ''' % (str('open_session')))
    f.close()

At the I would like to get sth like that:

def open_session(self):
        yield self.env.timeout(random.choice([0.01,0.02,0.4]))
sk306
  • 29
  • 4

0 Answers0