Dinesh B Vadhia wrote:
Have a large number (> 1bn) of integer co-ordinates (i, j). The i are
ordered and the j unordered.
I want to create (j, i) with j ordered and i unordered ie.
from:
...
6940, 22886
6940, 38277
6940, 43788
...
to:
...
38277, 567
38277, 90023
38277, 6940
...
I've
> greg whittier wrote:
>> On Thu, Mar 12, 2009 at 4:24 PM, ski wrote:
>> mylist = [{'a': 'x123', 'b':'12'}, {'a': 'x234', 'b': 'd33', 'c':
>> 'a23'}, {'a': 'x234', 'c': 'XX123'} ]
>>> where mylist has nth number of dictionaries and i want to merge the
>>> values
>>> of the keys that a
I'm a little bored, so I wrote a function that gets elements
and puts them in a dictionary. Missing elements are just an empty
string.
http://gist.github.com/78385
Usage:
>>> d = process_finding(findings[0])
>>> ", ".join(map(lambda e: d[e], elements))
u'V0006310, NF, , , GD, 2.0.8.8, TRUE, DTBI
So you want one line for each element? Easy:
# Get elements
findings = domDatasource.getElementsByTagName('FINDING')
# Get the text of all direct child nodes in each element
# That's assuming every child has a TEXT_NODE node.
lines = []
for finding in findings:
lines.append([f.firstChild.d
how would you do this for a specific key instead of all the keys?
greg whittier wrote:
On Thu, Mar 12, 2009 at 4:24 PM, ski wrote:
Hello,
I have this issue, which I am unsure on how to solve.
mylist1 = {'a': 'x123', 'b':'12'}
mylist2 = {'a': 'x234', 'c': 'a23'}
for k in mylist2:
... if
On Thu, Mar 12, 2009 at 08:47:24PM +0100, Stefan Behnel wrote:
> m...@marcd.org wrote:
[snip]
>
> There is another "DOM Model" in the stdlib. It's called ElementTree and is
> generally a lot easier to use. For example, to find the text content of an
> element called "element_that_has_text_content
On Thu, Mar 12, 2009 at 4:24 PM, ski wrote:
> Hello,
> I have this issue, which I am unsure on how to solve.
>
mylist1 = {'a': 'x123', 'b':'12'}
mylist2 = {'a': 'x234', 'c': 'a23'}
for k in mylist2:
> ... if k in mylist1:
> ... mylist1[k] = [mylist1[k], mylist2[k]]
>
Hello,
I have this issue, which I am unsure on how to solve.
>>> mylist1 = {'a': 'x123', 'b':'12'}
>>> mylist2 = {'a': 'x234', 'c': 'a23'}
>>> for k in mylist2:
... if k in mylist1:
... mylist1[k] = [mylist1[k], mylist2[k]]
... else:
... mylist1[k] = mylist2[k]
...
m...@marcd.org wrote:
> I am new to Python and as a first project decided to try to parse an XML
> report using Python. I have the following, which works to extract one
> element. I am stuck, however, at one element. I want to extract several
> differenct elements per line, creating a comma sepa
2009/3/12 Emad Nawfal (عماد نوفل) :
> Hi Tutors,
> I've never had a situation in which this was useful for me, but I'm just
> curious.
> If there is a text file that has a list or number of lists in it, is there
> is a way to read the lists in the file as lists, and not as a string. Sample
> file a
"Dinesh B Vadhia" wrote
Have a large number (> 1bn) of integer co-ordinates (i, j).
I want to create (j, i) with j ordered and i unordered ie.
I've tried the dictionary route and it works perfectly for small set
of
co-ordinate pairs but not for large sets as it hits memory capacity.
One
Emad Nawfal (عماد نوفل) wrote:
Hi Tutors,
I've never had a situation in which this was useful for me, but I'm just
curious.
If there is a text file that has a list or number of lists in it, is
there is a way to read the lists in the file as lists, and not as a
string. Sample file attached.
"Emad Nawfal (عماد نوفل)" wrote
If there is a text file that has a list or number of lists in it, is
there
is a way to read the lists in the file as lists, and not as a
string. Sample
file attached.
Not that I know of. If you made the file include assignments to
variables
or one big list
On Thu, Mar 12, 2009 at 11:41 AM, spir wrote:
> Le Thu, 12 Mar 2009 11:13:33 -0400,
> Kent Johnson s'exprima ainsi:
>
>> Because local name lookup is faster than global name lookup. Local
>> variables are stored in an array in the stack frame and accessed by
>> index. Global names are stored in a
Hi Tutors,
I've never had a situation in which this was useful for me, but I'm just
curious.
If there is a text file that has a list or number of lists in it, is there
is a way to read the lists in the file as lists, and not as a string. Sample
file attached.
--
لا أعرف مظلوما تواطأ الناس علي هض
Le Thu, 12 Mar 2009 11:13:33 -0400,
Kent Johnson s'exprima ainsi:
> Because local name lookup is faster than global name lookup. Local
> variables are stored in an array in the stack frame and accessed by
> index. Global names are stored in a dict and accessed with dict access
> (dict.__getitem__
On Thu, Mar 12, 2009 at 8:13 AM, Poor Yorick
wrote:
> In the following snippet, the loop in the global namespace takes twice as
> long
> as the loop in the function namespace. Why?
Because local name lookup is faster than global name lookup. Local
variables are stored in an array in the stack fr
On Thu, Mar 12, 2009 at 9:43 AM, Dinesh B Vadhia
wrote:
> Have a large number (> 1bn) of integer co-ordinates (i, j). The i are
> ordered and the j unordered.
>
> I want to create (j, i) with j ordered and i unordered ie.
>
> from:
>
> ...
> 6940, 22886
> 6940, 38277
> 6940, 43788
> ...
>
> to:
>
Have a large number (> 1bn) of integer co-ordinates (i, j). The i are ordered
and the j unordered.
I want to create (j, i) with j ordered and i unordered ie.
from:
...
6940, 22886
6940, 38277
6940, 43788
...
to:
...
38277, 567
38277, 90023
38277, 6940
...
I've tried the dictionary route and
In the following snippet, the loop in the global namespace takes twice as long
as the loop in the function namespace. Why?
limit = 5000
def f1():
counter = 0
while counter < limit:
counter += 1
time1 = time.time()
f1()
print(time.time() - time
20 matches
Mail list logo