On 10/11/10 07:36, Ian Kelly wrote:
On 11/9/2010 11:14 PM, r0g wrote:
Me too when possible, TBH if I only needed strings and there was no
pressing security issue I'd just do this...
config = {}
for line in (open(config.txt, 'r')):
if len(line) 0 and line[0] #:
param, value =
On Nov 10, 6:36 pm, Ian Kelly ian.g.ke...@gmail.com wrote:
That's five whole lines of code. Why go to all that trouble when you
can just do this:
import config
I kid, but only partially.
For myself, generally because I only become aware of the module, or
the module is only written after
On Nov 10, 5:00 pm, Stefan Behnel stefan...@behnel.de wrote:
Give lxml.objectify a try. It doesn't use DTDs, but does what you want.
Yes I should take the time to familiarise myself with the lxml API in
general. I mostly use libxml2 and libxslt nowadays. For simple stuff
(like this) I use a
I'll look at the options. But anyway, only to give an example of the
configs I told, the ShoX project (at sourceforge.net) has xml as
config files. I'm not talking about common users to edit the xmls,
it's about the developer edit them :-) I'm working in a python
wireless sensor network simulator,
On Nov 10, 1:05 am, r0g aioe@technicalbloke.com wrote:
That's five whole lines of code. Why go to all that trouble when you can
just do this:
import config
Heh, mainly because I figure the config module will have a lot more
options than I have use for right now and therefore the docs
Felipe Bastos Nunes, 10.11.2010 13:34:
Does any, libxml2 or lxml, collect children like jdom does in java?
ListElement children = myRoot.getChildren();
Bah, that's *so* Java. ;)
ElementTree and lxml.etree do it like this:
children = list(myRoot)
lxml also supports XPath and lots
Am 10.11.2010 04:36, schrieb Asun Friere:
Yes but configuration files are not necessarily meant to be edited by
humans either!
Yeah, you are right. I'm sorry but every time I read XML and
configuration in one sentence, I see the horror of TomCat or Shibboleth
XML configs popping up.
--
In message mailman.798.1289358171.2218.python-l...@python.org, Christian
Heimes wrote:
Don't repeat the mistakes of others and use XML as a configuration
language. XML isn't meant to be edited by humans.
My principle is: anything automatically generated by machine is not fit for
viewing or
In message mailman.835.1289431211.2218.python-l...@python.org, Christian
Heimes wrote:
I'm sorry but every time I read XML and configuration in one sentence, I
see the horror of TomCat or Shibboleth XML configs popping up.
Tomcat I know is written in Java; let me guess—Shibboleth is too?
--
In message mailman.803.1289374804.2218.python-l...@python.org, Ian Kelly
wrote:
On 11/9/2010 11:14 PM, r0g wrote:
config = {}
for line in (open(config.txt, 'r')):
if len(line) 0 and line[0] #:
param, value = line.rstrip().split(=,1)
config[param] = value
That's
On 11/10/2010 10:07 PM, Lawrence D'Oliveiro wrote:
In message mailman.803.1289374804.2218.python-l...@python.org, Ian Kelly
wrote:
On 11/9/2010 11:14 PM, r0g wrote:
config = {}
for line in (open(config.txt, 'r')):
if len(line) 0 and line[0] #:
param, value =
On 10/11/10 20:38, Ian wrote:
On Nov 10, 1:05 am, r0gaioe@technicalbloke.com wrote:
That's five whole lines of code. Why go to all that trouble when you can
just do this:
import config
Heh, mainly because I figure the config module will have a lot more
options than I have use for
On 10/11/10 23:18, Christian Heimes wrote:
Am 10.11.2010 04:36, schrieb Asun Friere:
Yes but configuration files are not necessarily meant to be edited by
humans either!
Yeah, you are right. I'm sorry but every time I read XML and
configuration in one sentence, I see the horror of TomCat or
Now that PyXML (and thus xmlproc) is defunct, does anyone know any
handy modules (apart from re :) for parsing DTDs?
--
http://mail.python.org/mailman/listinfo/python-list
I'd like to know too. I work with java and jdom, but I'm doing
personal things in python, and plan to go full python in the next 2
years. Xml is my first option for configuration files and simple
storages.
2010/11/10, Asun Friere afri...@yahoo.co.uk:
Now that PyXML (and thus xmlproc) is defunct,
Am 10.11.2010 03:44, schrieb Felipe Bastos Nunes:
I'd like to know too. I work with java and jdom, but I'm doing
personal things in python, and plan to go full python in the next 2
years. Xml is my first option for configuration files and simple
storages.
Don't repeat the mistakes of others
On Nov 10, 2:02 pm, Christian Heimes li...@cheimes.de wrote:
Am 10.11.2010 03:44, schrieb Felipe Bastos Nunes:
I'd like to know too. I work with java and jdom, but I'm doing
personal things in python, and plan to go full python in the next 2
years. Xml is my first option for configuration
On Nov 10, 2:02 pm, Christian Heimes li...@cheimes.de wrote:
Back to the initial question: I highly recommend LXML for any kind of
XML processing, validation, XPath etc.
Sorry Christian, didn't realise at first that that was a response to
MY intial question. But does lxml actually have
Asun Friere, 10.11.2010 04:42:
On Nov 10, 2:02 pm, Christian Heimes wrote:
Back to the initial question: I highly recommend LXML for any kind of
XML processing, validation, XPath etc.
Sorry Christian, didn't realise at first that that was a response to
MY intial question. But does lxml
On Nov 10, 4:11 pm, Stefan Behnel stefan...@behnel.de wrote:
What's your interest in parsing a DTD if you're not up to validating XML?
Spitting out boilerplate code.
Just at the moment I'm creating a stub XSLT sheet, which creates a
template per element (from a 3rd party DTD with 143 elements,
Asun Friere, 10.11.2010 06:41:
On Nov 10, 4:11 pm, Stefan Behnel wrote:
What's your interest in parsing a DTD if you're not up to validating XML?
Spitting out boilerplate code.
[...]
A few years back I used a similar technique to write some boiler plate
python code where xml was
On 10/11/10 03:36, Asun Friere wrote:
On Nov 10, 2:02 pm, Christian Heimesli...@cheimes.de wrote:
Am 10.11.2010 03:44, schrieb Felipe Bastos Nunes:
I'd like to know too. I work with java and jdom, but I'm doing
personal things in python, and plan to go full python in the next 2
years. Xml is
On 11/9/2010 11:14 PM, r0g wrote:
Me too when possible, TBH if I only needed strings and there was no
pressing security issue I'd just do this...
config = {}
for line in (open(config.txt, 'r')):
if len(line) 0 and line[0] #:
param, value = line.rstrip().split(=,1)
config[param] = value
23 matches
Mail list logo