how to save a modified .xml back

2009-12-25 Thread Hyunchul Kim
Hi all, I want to load a small .xml file, modifiy some nodes and save the .xml with modifications to another .xml file. I managed to load and modify a small .xml file using xml.dom.minidom and xml.dom.pulldom. However, I don't know how to save it back using any of two modules. Any suggestion?

Re: faster than list.extend()

2009-11-17 Thread Hyunchul Kim
r = range(3) return [x for x in i for _ in r] I didn't know that list(t2(inputlist)) is much faster than t2_1(inputlist), it's gonna be a helpful tip for me. Thank you all. Hyunchul On Tue, Nov 17, 2009 at 7:55 AM, Tim Chase wrote: > Hyunchul Kim wrote: > >> Hi, all. &g

faster than list.extend()

2009-11-16 Thread Hyunchul Kim
Hi, all. I want to improve speed of following simple function. Any suggestion? ** def triple(inputlist): results = [] for x in inputlist: results.extend([x,x,x]) return results ** Thank you in advance, Hyunchul -- http://mail.python.org/mailman/listinfo/python-list

sequential multiple processes

2009-10-24 Thread Hyunchul Kim
Hi, all How to run multiple processes with sequential input of a thousand of data in a script run? I have a python script and 1,000 independent input data for it. Previously, I divided input data into* n* groups and ran a same python script *n* times to use *n* processors. It's inconvenient. Ho

speed of string chunks file parsing

2009-04-06 Thread Hyunchul Kim
Hi, all I have a simple script. Can you improve algorithm of following 10 line script, with a view point of speed ? Following script do exactly what I want but I want to improve the speed. This parse a file and accumulate lines till a line match a given regular expression. Then, when a line m

Re: how to convert from Decimal('1.23456789') to Decimal('1.234')

2009-03-23 Thread Hyunchul Kim
In that case, I usually use # when rounding is proper, s = '1.23456789' print round(float(s)) or # when cut out is proper, from math import floor print floor(float(s)*1000)/1000 Hyunchul valpa wrote: I only need the 3 digits after '.' Is there any way other than converting from/to string? -

Re: unbiased benchmark

2009-03-12 Thread Hyunchul Kim
In the system that I tested, results were different. * System was CPU: AMD Phenom(tm) 9950 Quad-Core Processor, Frequency 2600MHz, L2 cache 512KB Memory 3164MB OS: Ubuntu 8.10 When I tried this benchmark for the first time, i...@pc:~$ time python bench.py real0m0.010s user

Re: how to find all completely connected sub-graphs?

2009-03-02 Thread Hyunchul Kim
Dear Odeits, Yes, I meant directly connected to each other. Thanks. Hyunchul odeits wrote: On Mar 2, 10:35 pm, Hyunchul Kim wrote: Hi, all, How can I find all "completely connected subgraphs" in a graph when node and edge data are available? "completely connected subgr

how to find all completely connected sub-graphs?

2009-03-02 Thread Hyunchul Kim
Hi, all, How can I find all "completely connected subgraphs" in a graph when node and edge data are available? "completely connected subgraph" is a group, all members of which are connected to each other. Thanks, Hyunchul -- http://mail.python.org/mailman/listinfo/python-list

How to decompress .Z file?

2007-08-20 Thread Hyunchul Kim
Hi, all How can .Z file be decompressed? According to python library reference, .Z file might not be supported by python, yet. Best, Hyunchul Kim -- http://mail.python.org/mailman/listinfo/python-list

[python-list] pdf read & write

2007-07-27 Thread Hyunchul Kim
store tag information to additional file outside pdf file. Any suggestion are welcome. Best, Hyunchul Kim -- http://mail.python.org/mailman/listinfo/python-list

[python-list] pdf read & write

2007-07-27 Thread Hyunchul Kim
store tag information to additional file outside pdf file. Any suggestion are welcome. Best, Hyunchul Kim -- http://mail.python.org/mailman/listinfo/python-list