Problem in writing demands to the xml file

varun7rs at gmail.com varun7rs at gmail.com
Tue May 20 04:06:59 EDT 2014


There is no traceback error. But I want to actually fill the demands with certain attributes which I'm not able to do. When I run the program, the xml is written but the demands doesn't have any attributes whatsoever. I could give you a clear idea of what I expect in the demands. For every node, I have an attribute called totaldemands which takes a value between 1 and 5. Now, I need the same no. of demands being written onto the xml file below every node which is now empty

        totaldemands = random.randint(1, 5)
        demnum = 0
        for demand in range(totaldemands):
            demnum = demnum + 1
            PoPbdw = random.uniform(2, 2.5)
            PoPstor = random.uniform(2, 2.5)
            PoPpro = random.uniform(0.5, 1)
            MMEbdw = random.uniform(2, 2.5)
            MMEstor = random.uniform(2, 3)
            MMEpro = random.uniform(0.5, 1)
            IMSbdw = random.uniform(2.5, 3)
            IMSstor = random.uniform(2.5, 3.5)
            IMSpro = random.uniform(0.5, 1)
            SGWbdw = random.uniform(3, 3.5)
            SGWstor = random.uniform(2.5, 3.5)
            SGWpro = random.uniform(0.5, 1)
            PGWbdw = random.uniform(2.5, 3.5)
            PGWstor = random.uniform(2, 2.5)
            PGWpro = random.uniform(0.5, 1)



More information about the Python-list mailing list