CSV with comments
In csv.reader, is there any way of skip lines that start whith '#' or empty lines I would add comments at my CSV file -- http://mail.python.org/mailman/listinfo/python-list
Re: CSV with comments
GinTon wrote: > In csv.reader, is there any way of skip lines that start whith '#' or > empty lines > I would add comments at my CSV file For skip comment I get a dirty trick: reader = csv.reader(open(csv_file)) for csv_line in reader: if csv_line[0].startswith('#'): continue But not possible let blank lines. I think that CSV class should to let skip comments and new lines of auto. way. -- http://mail.python.org/mailman/listinfo/python-list
Re: CSV with comments
and which method is the best, Daniel's generator or the subclass? -- http://mail.python.org/mailman/listinfo/python-list
BeautifulSoup to get string inner 'p' and 'a' tags
I'm trying to get the 'FOO' string but the problem is that inner 'P' tag there is another tag, 'a'. So: > from BeautifulSoup import BeautifulSoup > s = ' FOO name="f"> ' > tree = BeautifulSoup(s) > print tree.first('p') FOO So if I run 'print tree.first('p').string' to get the 'FOO' string it shows Null value because it's the 'a' tag: > print tree.first('p').string Null Any solution? -- http://mail.python.org/mailman/listinfo/python-list
Re: BeautifulSoup to get string inner 'p' and 'a' tags
Marc 'BlackJack' Rintsch wrote: > In [53]: print tree.first('p').contents[0] > FOO > Thanks! I was going to crazy with this. -- http://mail.python.org/mailman/listinfo/python-list
Integration of globalization data in Python web frameworks
I have created several tables in CSV format with globalization data (G11n). There are tables for countries, areas, languages, countries & languages, time zones, phones. And they are licensed under a Creative Commons license. http://svn.webda.python-hosting.com/trunk/G11n_data/ I created a new discussion group in order to facilitate the integration of G11n data in any framework. It's focused on integrate it on Django and TurboGears, but it could be integrated in whatever application with the help of the discussions on this group. It's necessary to discuss several subjects before beginning with the integration in the web frameworks. So I ask your collaboration. Thanks! http://groups.google.com/group/webda P.S.: I hope that you don't see this post as SPAM. This is something very interesting for administrators and users of those web frameworks. -- http://mail.python.org/mailman/listinfo/python-list
Re: Integration of globalization data in Python web frameworks
The project web is activated http://webda.python-hosting.com/ GinTon wrote: > I have created several tables in CSV format with globalization data > (G11n). There are tables for countries, areas, languages, countries & > languages, time zones, phones. And they are licensed under a Creative > Commons license. > > http://svn.webda.python-hosting.com/trunk/G11n_data/ > > I created a new discussion group in order to facilitate the integration > of G11n data in any framework. It's focused on integrate it on Django > and TurboGears, but it could be integrated in whatever application with > the help of the discussions on this group. > > It's necessary to discuss several subjects before beginning with the > integration in the web frameworks. So I ask your collaboration. Thanks! > > http://groups.google.com/group/webda > > P.S.: I hope that you don't see this post as SPAM. This is something > very interesting for administrators and users of those web frameworks. -- http://mail.python.org/mailman/listinfo/python-list
EyeDB Object Database (ODBMS) - Python wrapper
EyeDB is a free ODBMS based on the ODMG 3 specification with programming interfaces for C++ and Java. It is very powerfull, mature, safe and stable. In fact, it was developed in 1992 for the Genome View project althought rewritten in 1994, and has been used in a lot of bioinformatics projects http://www.eyedb.org/ Python does not have any programming interface to ODBMS and I believe that it would be very interesting that the Python community could access to a great object database like this one. If somebody is interested could to using SIP as Python wrapper. PyQT4 bindings were made with SIP http://www.riverbankcomputing.co.uk/sip/ These are the conclusions of several Python wrappers that shows that SIP generates the fastest wrappers: http://people.web.psi.ch/geus/talks/europython2004_geus.pdf * Manual wrapping is still fastest and most versatile * SIP, Boost and Babel generate native extension modules with low overhead * SWIG-generated modules rely on pure Python wrapper module and introduce a large overhead * Wrapper tool highlights: - SIP generates the fastest wrappers - SWIG is mature and well documented - Boost.Python most elegant integration of C++ and Python - Babel supports languages as both target and source If you want to know more about ODBMS here you have some interesting links: http://en.wikipedia.org/wiki/Object_database http://www.dacs.dtic.mil/techs/oodbms2/oodbms-toc.shtml http://www.kuro5hin.org/?op=displaystory;sid=2001/5/3/32853/11281 http://www.odbms.org/introduction_whenODBMS.html http://archive.devx.com/dbzone/articles/sf0801/sf0801-1.asp -- http://mail.python.org/mailman/listinfo/python-list
Re: EyeDB Object Database (ODBMS) - Python wrapper
I received the following answer of Eric Viara, EyeDB.org: "We planned to introduce soon a plugin mechanism to facilitate the way to write language bindings such as PHP5, Python, PERL and so on. But we do not know yet if the Python binding will be written by the core staff. We do not plan to support XML in the few months. But as eyedb is an open source project, we expect that somebody else will write supports for XML." In any case I advised to him that the creation of a Google group would be positive to obtain a community interested in that project. -- http://mail.python.org/mailman/listinfo/python-list
sys.stderr.write and sys.exit
Is the same use _sys.stderr.write('error message'); sys.exit(1)_ than _sys.exit('error message')_ ? Note: help(sys.exit) If the status is omitted or None, it defaults to zero (i.e., success). If the status is numeric, it will be used as the system exit status. If it is another kind of object, it will be printed and the system exit status will be one (i.e., failure). -- http://mail.python.org/mailman/listinfo/python-list
Access to variable from external imported module
How to access to a variable (that value is not returned) from a module imported? And the variable is set at the module-level. That module is external to my program, it's from another project so I wann't modifying it. -- http://mail.python.org/mailman/listinfo/python-list
Re: Access to variable from external imported module
Sorry, I mean access to local variable from a method import module method(value) I would to access to values that are created locally in that method Fredrik Lundh ha escrito: > GinTon wrote: > > > How to access to a variable (that value is not returned) from a module > > imported? > > And the variable is set at the module-level. > >import module >print module.variable > > (have you read the Python tutorial?) > > -- http://mail.python.org/mailman/listinfo/python-list
Re: Access to variable from external imported module
Thanks Robert, the best solution is get all local variables, else is impossible access to them. robert ha escrito: > GinTon wrote: > > I would to access to values that are created locally in that method > > after the method has executed? usually the return value? > or you want to get all local variables, then make a func/method > > def f(a=1): > b=2 > c=3 > return locals() #X/Object(locals()) > > > > d=module.f() > print d['c'] # d.c -- http://mail.python.org/mailman/listinfo/python-list
Re: sys.stderr.write and sys.exit
Thanks Ben Finney. So it's understood very well. Ben Finney ha escrito: > "GinTon" <[EMAIL PROTECTED]> writes: > > > Is the same use >>>>> sys.stderr.write('error message'); sys.exit(1) > > than >>>>> sys.exit('error message') ? > > Code that wants to catch SystemExit will get a different exception > object in each case:: > > >>> import sys > >>> from StringIO import StringIO > >>> sys.stderr = StringIO() > > >>> try: > ... sys.stderr.write('error message') > ... sys.exit(1) > ... except SystemExit, e: > ... print "stderr contains:", sys.stderr.getvalue() > ... print "e.code is:", e.code > ... > stderr contains: error message > e.code is: 1 > > >>> try: > ... sys.exit('error message') > ... except SystemExit, e: > ... print "stderr contains:", sys.stderr.getvalue() > ... print "e.code is:", e.code > ... > stderr contains: error message > e.code is: error message > > I quite often catch SystemExit in unit tests, or other code that is > inspecting a program module. -- http://mail.python.org/mailman/listinfo/python-list