Hello,
2011/8/31 T. Goodchild :
> But one of the things that bugs me is the requirement that all class
> methods have 'self' as their first parameter. On a gut level, to me
> this seems to be at odds with Python’s dedication to simplicity.
I think the answer to this question is part of the zen o
Hello,
2011/2/11 yanghq :
> but for some pages rendered by js, like:
You could use selenium or windmill to help you reproduce the contents
of the web page in a browser so you can get the data from the DOM tree
once the page has been rendered instead of by parsing the js.
Best regards,
Jav
Hello,
2010/12/30 :
> How can i do the same thing (wildcard in a directory name) in python please ?
You can get the contents of a directory with os.listdir and filter
with fnmatch.fnmatch more or less as in the example from the
documentation:
-
import fnmatch
import os
for f
Hello,
2010/11/26 Joe Goldthwaite :
> I’m attempting to parse some basic tagged markup.
>
> Elementree and lxml seem to want a full formatted
> page, not a small segment like this one.
BeautifulSoup (http://www.crummy.com/software/BeautifulSoup/) could
help in the parsing:
>>> from BeautifulSou
Thanks for your answers. They helped me to realize that I was
mistakenly using match.string (the whole string) when I should be
using math.group(0) (the whole match).
Best regards,
Javier
--
http://mail.python.org/mailman/listinfo/python-list
Hello,
Let's imagine that we have a simple function that generates a
replacement for a regular expression:
def process(match):
return match.string
If we use that simple function with re.sub using a simple pattern and
a string we get the expected output:
re.sub('123', process, '123')
'123'
H
Hello,
2010/5/6 james_027 :
> I was working with regex on a very large text, really large but I have
> time constrained. Does python has any other regex library or string
> manipulation library that works really fast?
re2 (http://code.google.com/p/re2/) is suppossed to be faster than the
standard
> I'm only aware of Hyde (http://ringce.com/hyde)
There are also jekyll and cyrax:
http://github.com/mojombo/jekyll/
http://pypi.python.org/pypi/cyrax/0.1.5
I haven't tried any of them, but it looks like cyrax is in active
development and its design was inspired in both jekyll and hyde.
Best reg
Hello,
I haven't used httplib2, but you can certainly use any other
alternative to send HTTP requests:
- urllib/urllib2
- mechanize
With regard to how do you find the form you're looking for, you may:
- create the HTTP request on your own with urllib2. To find out what
variables do you need to po
Hello,
You can find some advice here:
http://www.packtpub.com/article/web-scraping-with-python-part-2
Best regards,
Javier
2010/1/27 mierdatutis mi :
> Hello again,
>
> What test case for Windmill? Can you say me the link, please?
>
> Many thanks
>
> 2010/1/27 Javier
Hello,
A test case for Windmill might also be used to extract the information
that you're looking for.
Best regards,
Javier
2010/1/27 mierdatutis mi :
> Those videos are generated by javascript.
> There is some parser with python for javascript???
>
> Thanks a lot!
>
>
> 2010/1/27 Simon Brun
Hello,
To accept cookies, use the HTTPCookieProcessor as explained here:
http://www.nomadjourney.com/2009/03/automatic-site-login-using-python-urllib2/
Best regards,
Javier
2010/1/27 Andre Engels :
> On Wed, Jan 27, 2010 at 6:26 AM, Patrick wrote:
>> I'm trying to scrape the attached link f
Hello,
One tool that I really like is doit:
http://python-doit.sourceforge.net/
If you need to execute jobs remotely, you may like to take a look at STAF:
http://staf.sourceforge.net/index.php
Best regards,
Javier
2010/1/26 Chris Rebert :
> On Tue, Jan 26, 2010 at 10:58 AM, wrote:
>> My c
Hello,
I think the site is under maintenance. I tried a couple of hours ago
and it worked fine.
As an alternative, I found that this link also worked:
http://www.sikuli.org/
Unfortunately, it seems it's not working right now.
Best regards,
Javier
2010/1/25 Virgil Stokes :
> On 25-Jan-2010
Hello,
If you set shell=False, then I think that arg2 should be separated
into two different parts.
Also, arg3 could be set just to pattern (no need to add extra spaces
or using str function).
Best regards,
Javier
2010/1/21 Tomas Pelka :
> Hey all,
>
> have a problem with following piece of
Hello,
I'd say that isn't totally incorrect to use strings instead of
symbols. Please note that in other programming languages symbols,
atoms and the like are in fact immutable strings, which is what python
provides by default.
Best regards,
Javier
2010/1/21 Alf P. Steinbach :
> * Martin Dra
Hello,
I think that's exactly what the cpaste magic function does. Type
'cpaste?' in your IPython session for more information.
Best regards,
Javier
2010/1/14 Reckoner :
>
> Hi,
>
> I am studying some examples in a tutorial where there are a lot of
> leading >>> characters and ellipsis in th
Hello,
If a script that uses mechanize fails to find an html node that has
been identified with Firebug, this is probably because that node has
been autogenerated (provided that the expression to get the node is
correct).
As an alternative to verify this, you can try to download the html
page and
Hello,
If you are working on linux, you can change the shebang line from:
#!/usr/bin/python
to:
#!/usr/bin/python2.6
Best regards,
Javier
P.S. If you just want to avoid python 3 while running the latest
python 2.x version, this should also work:
#!/usr/bin/python2
2009/11/11 Benjamin Kapla
Hello,
I'll do the following:
[op1+op2 for op1,op2 in zip(operandlist1, operandlist2)]
Best regards,
Javier
2009/11/2 Jon P. :
> I'd like to do:
>
> resultlist = operandlist1 + operandlist2
>
> where for example
>
> operandlist1=[1,2,3,4,5]
> operandlist2=[5,4,3,2,1]
>
> and resultlist will
Hello,
I think that the best information available on the subject is the following:
http://www.dabeaz.com/generators/
http://www.dabeaz.com/coroutines/
Best regards,
Javier
2009/10/14 Peng Yu :
> http://docs.python.org/reference/simple_stmts.html#grammar-token-yield_stmt
>
> The explanation
Hello,
Google is your friend:
http://sourceforge.net/projects/pexpect/
http://sourceforge.net/projects/pexpect/files/pexpect/Release%202.3/pexpect-2.3.tar.gz/download
Best regards,
Javier
2009/10/13 Antoon Pardon :
> I have been looking for pexpect. The links I find like
> http://pexpect.sou
Hello,
I recommend you to check this:
https://wiki.ubuntu.com/PackagingGuide/Complete
The best way to release the software to Ubuntu users is by means of a
PPA (https://help.launchpad.net/Packaging/PPA) so that people can
track your application updates automatically. Before the PPA is
created you
Hello,
This page has some advice about how to avoid some of the lambda
functions limitations:
http://p-nand-q.com/python/stupid_lambda_tricks.html
In particular, it suggests to use map function instead of for loops.
Best regards,
Javier
2009/8/31 Pierre :
> Hello,
>
> I would like to know i
Hello,
I think that this isn't possible with optparse library.
However, it's possible with argparse (http://code.google.com/p/argparse/):
http://argparse.googlecode.com/svn/trunk/doc/other-methods.html#sub-commands
It's not a standard library, but it's worth to take a look at it.
Best regards,
Hello,
According to my experience and from what I've read in other threads,
subprocess isn't easy to use for interactive tasks. I don't really
know, but maybe it wasn't even designed for that at all.
On the other hand, pexpect seems to work fine for interactive use and
even provides a method for
Hello,
In the string.Template documentation
(http://docs.python.org/library/string.html) it's explained that if a
custom regular expression for pattern substitution is needed, it's
possible to override idpattern class attribute (whose default value is
[_a-z][_a-z0-9]*).
However, if the custom pat
Hello,
Have you considered using something that is already developed?
You could take a look at this presentation for an overview of what's available:
http://us.pycon.org/2009/conference/schedule/event/5/
Anyway, let me explain that, since I "discovered" it, my favourite
format for configuration
Hello,
Regarding packaging for debian (.deb), the best reference I've found is:
https://wiki.ubuntu.com/PackagingGuide/Python
However, all that mess probably won't be needed anymore once this is finished:
https://blueprints.edge.launchpad.net/ubuntu/+spec/desktop-karmic-automagic-python-build-sys
Hello,
I would like to be able to run the main script in a python project
from both the source tree and the path in which it's installed on
Ubuntu. The script, among other things, imports a package which in
turns makes use of some data files that contains some metadata that is
needed in xml format
Hello,
The problem might be that, aside from creating the Popen object, to
get the command run you need to call 'communicate' (other options, not
used with the Popen object directly, are 'call' or 'waitpid' as
explained in the documentation). Did you do that?
Best regards,
Javier
2009/6/19 T
Hello,
You're right, types.NoneType is not available in python 3.0, I wasn't
aware of that change. Thanks for pointing it out.
Best regards,
Javier
2009/6/12 Jeff McNeil :
> On Jun 12, 10:05 am, Paul LaFollette
> wrote:
>> Kind people,
>>
>> Using Python 3.0 on a Gatesware machine (XP).
>>
Hello,
This should work for you:
In [1]: import types
In [2]: isinstance(None, types.NoneType)
Out[2]: True
Best regards,
Javier
2009/6/12 Paul LaFollette :
> Kind people,
>
> Using Python 3.0 on a Gatesware machine (XP).
> I am building a class in which I want to constrain the types that
Hello,
It's strange behaviour. Have you tried argparse
(http://code.google.com/p/argparse/)? I've been using it for long time
without any problem like that?
Best regards,
Javier
2009/6/10 David Shapiro :
> Hello,
>
> I have been trying to find an example of how to deal with options that have
Take a look either at code.interact or at
IPython.ipapi.launch_new_instance. Basically, the only thing that you
have to provide is a dictionary object that contains the namespace
that you would like to have in your shell once it's launched.
Best regards,
Javier
2009/6/9 eGlyph :
> On Jun 9, 1
Hello,
I think that virtualenv could also do the job.
Best regards,
Javier
2009/6/5 Red Forks :
> maybe a shell script to switch PYTHONPATH, like:
> start-python-2.5
> start-python-2.4 ...
> On Fri, Jun 5, 2009 at 4:56 PM, David Cournapeau wrote:
>>
>> Hi,
>>
>> As I don't have admin privil
You're right. I agree on that it's important to use proper words.
Thanks for the correction.
Best regards,
Javier
2009/5/29 Steven D'Aprano :
> On Fri, 29 May 2009 12:04:53 +0200, Javier Collado wrote:
>
>> Hello,
>>
>> First thing is a class variable
Hello,
First thing is a class variable (one for every instance) and second
one an instance variable (one per instance).
For further information, please take a look at:
http://diveintopython.org/object_oriented_framework/class_attributes.html
Best regards,
Javier
2009/5/29 Kless :
> I usually
Hello,
I'm not an expert, but if you use setuptools for your application,
then a 'install_requires' argument would do the job. For more
information, please take a look at:
http://peak.telecommunity.com/DevCenter/setuptools
Best regards,
Javier
2009/5/12 Jason :
> I'm writing a small GUI (Pyt
39 matches
Mail list logo