>> I'm having problems with creating XML-documents,
>> because I don't seem to write it to a document correctly.
>Is that because you don't understand XML or because the
>output is not what you expect? How is the data being generated?
>Are you parsing an existing XML source or creating the XML
I'm having problems with creating XML-documents, because I don't seem to write
it to a document correctly. I have to write the document from a loop:
doc.write('\n')
for instance in query:
if doc != None:
text = str('\n' + \
' ' + st
I have made an extensive script that runs fine when started from the command
line or IDLE.
When I try to run it with cron it keeps giving errors:
Error in sys.exitfunc:
Traceback (most recent call last):
File "/usr/lib/python2.6/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
With difflib.context_diff it is possible to write the context to files.
difflib.context_diff(a, b[, fromfile][, tofile][, fromfiledate][, tofiledate][,
n][, lineterm])
Is it also possible to do this to seperate string-objects instead of writing
them to files?
___
Thank you all for the input.
I've not been clear in my original question. For each value in the range (in
example 10) I have to perform calculations with the values in the tuple (in
example 3). This makes 30 calculations in total.
In reality I have to do this for a much larger dataset (eg 1000
I'm having problems with iterations and loops. So I'm curious about the best
Python-way to do iterations of lists (in if, while etc statements) and breaking
of loops.
I have a list of tuples with 2 values. I want to perform calculations on all of
these for each value in a range of values (e.g.
I want to use **kwargs to check a list of conditions (if true do this, if false
do nothing) besides required parameters ( in sample a and b). Sometimes I want
to add a Python object (in example a dictionary and a list). Below is my first
**kwargs-brew.
###START
def function_with_kwargs(a, b,
I brew this up. It works, but I think it will be slow with a long text and a
big dictionary
def searchWord(text, dictionary):
'''search for terms in dictionary(key) and retrieve value(keywords)'''
text = text.split()
w = []
for word in text:
if word in dictionary:
>> I want to compare words in a text to a dictionary with values attached to
>> the words.
>>
>> The dictionary looks like:
>> { word1: [1,2,3] word2: [2,3,4,a,b ] ... }
>>
>
>Please give the actual dictionary, not something that it 'looks like' - an
>actual dictionary would never 'look like' thi
I want to compare words in a text to a dictionary with values attached to the
words.
The dictionary looks like:
{ word1: [1,2,3] word2: [2,3,4,a,b ] ... }
I'm trying to find a way to achieve this, but I'm having trouble getting
corrects results.
If I do the def below, nothing is matched.
def
I'm using pickle more often in my programs and now I store them as files.
I want to store them in ZODB or Durus to prevent losing sight of where I store
what pickled object.
Which one is the best one to use?
I've never worked with either one, so I would like to have some opinions. I
want to ac
I'm relatively new at Python and I'm trying to write a function that fills a
dictionary acording the following rules and (example) data:
Rules:
* No duplicate values in field1
* No duplicates values in field2 and field3 simultaneous (highest value in
field4 has to be preserved)
Rec.no field1,
12 matches
Mail list logo