[Mike Meyer]
> The thing to understand is that regular expressions are *search*
> functions, that return the first parsing that matches. They search a
> space of possible matches to each term in the expression. If some term
> fails to match, the preceeding term goes on to its next match, and you
>
On 3 Dec 2005 19:16:10 -0800, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
>I am trying to run an exe within a python script, but I'm having
>trouble with spaces in the directory name.
>
>The following example will display the usage statement of the program,
>so I know that the space in the path
I've just installed python 2.4.2 from source - it works fine from the
command line. But when I attempt to start idle, I am told:
** IDLE can't import Tkinter. Your Python may not be configured for
Tk. **
I have tcl 8.4 and tk 8.4 on my system; can anybody provide me with
some advice?
Sorry if
On 3 Dec 2005 15:50:25 -0800, "Brendan" <[EMAIL PROTECTED]> wrote:
>There must be an easy way to do this:
>
>For classes that contain very simple data tables, I like to do
>something like this:
>
>class Things(Object):
>def __init__(self, x, y, z):
>#assert that x, y, and z have the sa
> [John Hazen]
> > I want to match one or two instances of a pattern in a string.
> >
> > >>> s = 'foobarbazfoobar'
> > >>> foofoo = re.compile(r'^(foo)(.*?)(foo)?(.*?)$')
> > >>> foofoo.match(s).group(1)
> > 'foo'
> > >>> foofoo.match(s).group(3)
> > >>>
[Tim Peters]
> Your problem isn't that
>
Kay Schluehr wrote:
> In almost any case I install a Python package via distutils some
> directories in the package tree are left behind e.g. the docs,
> licenses, tests etc. I wonder if there is some rationale behind this?
> Should it be left to the "creative freedom" of the user to copy the
> doc
In almost any case I install a Python package via distutils some
directories in the package tree are left behind e.g. the docs,
licenses, tests etc. I wonder if there is some rationale behind this?
Should it be left to the "creative freedom" of the user to copy the
docs whereever she wants or is th
"Brendan" <[EMAIL PROTECTED]> writes:
> There must be an easy way to do this:
Not necessarily.
> For classes that contain very simple data tables, I like to do
> something like this:
>
> class Things(Object):
> def __init__(self, x, y, z):
> #assert that x, y, and z have the same leng
Google is your freind.
Try searching for:
python text wrapping
- Paddy.
--
http://mail.python.org/mailman/listinfo/python-list
John Hazen <[EMAIL PROTECTED]> writes:
> I want to match one or two instances of a pattern in a string.
Then you should be using the split() method of the match object on the
pattern in question.
> According to the docs for the 're' module
> ( http://python.org/doc/current/lib/re-syntax.html ) t
[John Hazen]
> I want to match one or two instances of a pattern in a string.
>
> According to the docs for the 're' module
> ( http://python.org/doc/current/lib/re-syntax.html ) the '?' qualifier
> is greedy by default, and adding a '?' after a qualifier makes it
> non-greedy.
>> The "*", "+", an
"Harlin Seritt" <[EMAIL PROTECTED]> writes:
> Is there a function that allows one to get the name of the same script
> running returned as a string?
The questions a little ambiguous, but one answer might be:
import sys
myname = sys.argv[0]
http://www.mired.org/home/mwm/
Hi,
I'm trying to create a script that will search an SGML file for the
numbers and titles of the hierarchical elements (section level
headings) and create a dictionary with the section number as the key
and the title as the value.
I've managed to make some progress but I'd like to get some gener
[EMAIL PROTECTED] wrote:
> This comes up from time to time. The brain damage is all Windows', not
> Python's. Here's one thread which seems to suggest a bizarre doubling
> of the initial quote of the commandline.
>
> http://groups.google.com/group/comp.lang.python/browse_frm/thread/89d94656ea393d
Brendan wrote:
...
>
> class Things(Object):
> def __init__(self, x, y, z):
> #assert that x, y, and z have the same length
>
> But I can't figure out a _simple_ way to check the arguments have the
> same length, since len(scalar) throws an exception. The only ways
> around this I've
Hi all,
I am relatively weak in Python and I need some help with this. I have built
a series of SOAP client functions that ping, authenticate (password
username), and query a SOAP server. All works well but I cannt figure out
on part of the download SOAP outgoing message. I also tried WSDL a
My understanding of .*? and its ilk is that they will match as little
as is possible for the rest of the pattern to match, like .* will match
as much as possible. In the first instance, the first (.*?) did not
have to match anything, because all of the rest of the pattern can be
matched 0 or more t
I don't have any problems with spaces in the folders.
just for debugging, you could probably try os.system(CMD.replace("\\", "/")
On 3 Dec 2005 19:16:10 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> I am trying to run an exe within a python script, but I'm having
> trouble with spaces in
This comes up from time to time. The brain damage is all Windows', not
Python's. Here's one thread which seems to suggest a bizarre doubling
of the initial quote of the commandline.
http://groups.google.com/group/comp.lang.python/browse_frm/thread/89d94656ea393d5b/ef40a65017848671
pgp1T5KPY01o
I want to match one or two instances of a pattern in a string.
According to the docs for the 're' module
( http://python.org/doc/current/lib/re-syntax.html ) the '?' qualifier
is greedy by default, and adding a '?' after a qualifier makes it
non-greedy.
> The "*", "+", and "?" qualifiers are all
I am trying to run an exe within a python script, but I'm having
trouble with spaces in the directory name.
The following example will display the usage statement of the program,
so I know that the space in the path to the exe is being handled
correctly and that the program was executed.
CMD= r'"
"Dustan" <[EMAIL PROTECTED]> writes:
> No, I mean given a big number, such as
> 1000, convert it into
> scientific notation.
It's the same.
>>> print "%e" % 1000
1.00e+51
--
Jorge Godoy <[
Roy Smith <[EMAIL PROTECTED]> wrote:
> In article <[EMAIL PROTECTED]>,
> "Dustan" <[EMAIL PROTECTED]> wrote:
>
> > 1000
>
> >>> print "%e" % 1000
> 1.00e+51
Exactly: the "%e" builds a ``scientif
In article <[EMAIL PROTECTED]>,
"Dustan" <[EMAIL PROTECTED]> wrote:
> 1000
>>> print "%e" % 1000
1.00e+51
--
http://mail.python.org/mailman/listinfo/python-list
No, I mean given a big number, such as
1000, convert it into
scientific notation.
--
http://mail.python.org/mailman/listinfo/python-list
Dustan <[EMAIL PROTECTED]> wrote:
> How can I get a number into scientific notation? I have a preference
> for the format '1 E 50' (as an example), but if it's well known, it
> works.
You mean something like:
>>> print '%e' % (1e50)
1.00e+50
...?
Alex
--
http://mail.python.org/mailman/li
Sam Pointon <[EMAIL PROTECTED]> wrote:
...
> So, assuming you want a Things object to break if either a) all three
> arguments aren't sequences of the same length, or b) all three
> arguments aren't a number (or string, or whatever), this should work:
>
> #Not tested.
> class Things(object):
>
Harlin Seritt <[EMAIL PROTECTED]> wrote:
> Is there a function that allows one to get the name of the same script
> running returned as a string?
Something like:
import sys
def f():
return sys.modules['__main__'].__file__
might help.
Alex
--
http://mail.python.org/mailman/listinfo/python-l
How can I get a number into scientific notation? I have a preference
for the format '1 E 50' (as an example), but if it's well known, it
works.
--
http://mail.python.org/mailman/listinfo/python-list
Is there a function that allows one to get the name of the same script
running returned as a string?
Thanks,
Harlin Seritt
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
>Hello,
>I am using python and CGI to initiate a long running simulation (up to
>5h long) on a remote machine. The main idea is that I use a form, enter
>the parameters and a CGI scripts start the simulation using these
>parameters. The structure of the script is:
>
>1. Re
"amfr" <[EMAIL PROTECTED]> wrote:
>
>import cgi
>form = cgi.FieldStorage()
>print form["test"]
>print "test"
>
>I would only be able to see "test", not "hello world"
>I am sure its not my browser
Did you mean:
print form["test"].value
--
- Tim Roberts, [EMAIL PROTECTED]
Providenza & Boekelhe
[EMAIL PROTECTED] wrote:
> Hello I tried to combine c++ and python together.
> So I follow from this website:
> http://kortis.to/radix/python_ext/
>
> and my setup.py file:
> from distutils.core import setup, Extension
> module = Extension('pr', sources = ['prmodule.c'])
> setup(name = 'Pr te
It depends what you mean by 'scalar'. If you mean in the Perlish sense
(ie, numbers, strings and references), then that's really the only way
to do it in Python - there's no such thing as 'scalar context' or
anything - a list is an object just as much as a number is.
So, assuming you want a Things
Brendan <[EMAIL PROTECTED]> wrote:
...
> def sLen(x):
> """determines the number of items in x.
> Returns 1 if x is a scalar. Returns 0 if x is None
> """
> xt = numeric.array(x)
> if xt == None:
> return 0
> elif xt.rank == 0:
> return 1
> else:
>
Hello I tried to combine c++ and python together.
So I follow from this website:
http://kortis.to/radix/python_ext/
I have this code:
# prmodule.c
static PyObject *pr_isprime(PyObject *self, PyObject *args){
int n, input;
if (!PyArg_ParseTuple(args, "i", &input))
return
* Brendan ([EMAIL PROTECTED]) wrote:
[...]
> Is there a simpler way to check that either all arguments are scalars,
> or all are lists of the same length? Is this a poor way to structure
> things? Your advice is appreciated
Disclaimer: I am new to python, so this may be a bad solution.
import t
There must be an easy way to do this:
For classes that contain very simple data tables, I like to do
something like this:
class Things(Object):
def __init__(self, x, y, z):
#assert that x, y, and z have the same length
But I can't figure out a _simple_ way to check the arguments have
Hello,
What is the convention for writing C functions which don't return a
value, but can fail?
If I understand correctly,
1. PyArg_ParseTuple returns 0 on failure and 1 on success.
2. PySet_Add returns -1 on failure and 0 on success.
Am I correct? What should I do with new C functions that I wr
On 3 Dec 2005 03:28:19 -0800, [EMAIL PROTECTED] wrote:
>
>Bengt Richter wrote:
>> On 2 Dec 2005 18:34:12 -0800, [EMAIL PROTECTED] wrote:
>>
>> >
>> >Bengt Richter wrote:
>> >> It looks to me like itertools.groupby could get you close to what you
>> >> want,
>> >> e.g., (untested)
>> >Ah, groupby.
D H enlightened us with:
> How is that a problem that some editors use 8 columns for tabs and
> others use less? So what?
I don't care either. I always use tabs, and my code is always
readable. Some people suggest one indents with four spaces, and
replaces eight spaces of indenting with a tab. No
Hello Mardy,
thanks a lot for your help. I found the problem. Your suggestion made
me look into some things I haven't thought before :-). I don't know if
it is a browser/server/mine fault. The problem was that I was sending
text/plain and a txt file. I soon as I started sending back to the
browser
Scott David Daniels wrote:
> Tom Anderson wrote:
>> So, could someone explain what's so evil about tabs?
>
>
> They appear in different positions on different terminals (older hard-
> copy), do different things on different OS's, and in general do not
> behave nicely. On many (but not all) syste
I'm new to both Perl & Python.
Is there a Python module or script somewhere comparable to the useful
Perl module - Text::Autoformat?
Thanks,
BS
--
http://mail.python.org/mailman/listinfo/python-list
Tom Anderson wrote:
> On Fri, 2 Dec 2005, [EMAIL PROTECTED] wrote:
>
>> Dave Hansen wrote:
>>
>>> TAB characters are evil. They should be banned from Python source
>>> code. The interpreter should stop translation of code and throw an
>>> exception when one is encountered. Seriously. At least
[EMAIL PROTECTED] wrote:
> ...
[I said]
>> So off-hand, I'd suspect some firewall thingie is getting in the way.
>> Can you "bless" \Python24\python.exe and \Python24\pythonw.exe as
>> applications allowed to do net traffic?
>
> Bingo!
> That's the problem: "Blocked outgoing TCP - Source Local
Thanks Scott
>
> This part I can help you with:
> >>> import platform
> >>> platform.platform()
> 'Windows-2000-5.0.2195-SP4' # in my case
> >>> platform.architecture()
> ('32bit', 'WindowsPE')
> >>> platform.python_version()
> '2.4.2'
> >>> platform.python
On Fri, 2 Dec 2005, [EMAIL PROTECTED] wrote:
> Dave Hansen wrote:
>
>> TAB characters are evil. They should be banned from Python source
>> code. The interpreter should stop translation of code and throw an
>> exception when one is encountered. Seriously. At least, I'm serious
>> when I say
I have been working to build a media toolkit that uses pygame to modify
image and sound data for the user. I have all of this working fine.
The one thing I am working on now is adding a pop-up view for the image
data as well as some pop-ups for file selection and color picking. I
am having proble
. I could actually touch-type on the psion (a genuine [/]pocket computer!)
but I was looking forward to eventually writing a key mapper
(new key layouts are always an aggravation)
. my plans were snipped in the bud however,
because I got cheap and tried to sneak around the warranty with a universal
Scott David Daniels wrote:
>> >>> int(u"\N{DEVANAGARI DIGIT SEVEN}")
>> 7
>
> OK, That much I have handled. I am fiddling with direct-to-number
> conversions and wondering about cases like
>>>> int(u"\N{DEVANAGARI DIGIT SEVEN}" + XXX
>+ u"\N{DEVANAGARI DIGIT SEVEN}")
int() passe
oops: www.snakecard.com/src
On Sat, 03 Dec 2005 12:26:52 -0600, Philippe C. Martin wrote:
> Dear all,
>
> I am very pleased to announce the release of SCPocketGrades V 0.1.
>
> SCPocketGrades is a GPL U3 smart drive-based grade book application.
>
> SCPocketGrades is coded in Python, wxPython,
Dear all,
I am very pleased to announce the release of SCPocketGrades V 0.1.
SCPocketGrades is a GPL U3 smart drive-based grade book application.
SCPocketGrades is coded in Python, wxPython, and C.
SCPocketGrades' main features are:
- (U3): no PC installation + data saved on smart drive (no m
>>if it is the *best* IDE for Python. <<
Nobody can answer this for you. Just try them all. The two I like that
I don't see mentioned in this thread are PythonCard (which is free) and
WingWare (which costs $30.00 but you can try for free.)
bs
--
http://mail.python.org/mailman/listinfo/python-li
Le die Fri, 02 Dec 2005 20:35:52 -0800, merry.sailor ha scribite:
> For step 3 I use either os.system or os.popen(2). The problem is that
> the web server does not send the information of step 2 back to the
> browser, unless step 3 is completed. The browser simply waits for a
> response, without di
Great stuff, thanks, it works.
--
http://mail.python.org/mailman/listinfo/python-list
johnclare wrote:
> Help - I'm (very) new to python. I want to run run a c executable from
> a python script - how do I do this?
>
> Many thanks for your help,
> j
>
generally:
import os
os.execl(program_location)
Look in os, Process management for further details. The next time
you as
[EMAIL PROTECTED] wrote:
> I've got a strange problem on windows (not very familiar with that OS).
> I can ping a host, but cannot get it via urllib (see here under).
> Thus network seems good, but not for python ;-(.
>
> Does any windows specialist can guide me (a poor linux user) to get
> N
Help - I'm (very) new to python. I want to run run a c executable from
a python script - how do I do this?
Many thanks for your help,
j
--
http://mail.python.org/mailman/listinfo/python-list
Martin v. Löwis wrote:
> Scott David Daniels wrote:
>> In reading over the source for CPython's PyUnicode_EncodeDecimal,
>> I see a dance to handle characters which are neither dec-equiv nor
>> in Latin-1. Does anyone know about the intent of such a conversion?
>
> To support this:
>
> >>> int(
I've got a strange problem on windows (not very familiar with that OS).
I can ping a host, but cannot get it via urllib (see here under).
I can even telnet the host on port 80.
Thus network seems good, but not for python ;-(.
Does any windows specialist can guide me (a poor linux user) to get
Ne
Jeffrey Schwab wrote:
> [EMAIL PROTECTED] wrote:
>> hello,
>>
>> i often encounter something like:
>>
>> acc = []# accumulator ;)
>> for line in fileinput.input():
>> if condition(line):
>> if acc:#1
>> doSomething(acc)#1
>> acc = []
>> else:
>>
[EMAIL PROTECTED] wrote:
> [EMAIL PROTECTED] wrote:
> > Hello,
> > I am using python and CGI to initiate a long running simulation (up to
> > 5h long) on a remote machine. The main idea is that I use a form, enter
> > the parameters and a CGI scripts start the simulation using these
> > parameters.
Steve Holden wrote:
> could ildg wrote:
>> Will string operation in python also leave some garbage? I implemented
>> a net-spider in python which includes many html string procession.
>> After it running for sometime, the python exe eats up over 300M
>> memory. Is this because the string garbage
On Sat, 03 Dec 2005 22:32:22 +1300, Tony Meyer wrote:
os.rename(sys.executable, "d:\\python24.exe")
What happens if you specify a destination file on the same drive as the
source file ?
--
http://mail.python.org/mailman/listinfo/python-list
The rpncalc package adds an interactive Reverse Polish Notation (RPN)
interpreter to Python. This interpreter allows the use of Python as
an RPN calculator. You can easily switch between the RPN interpreter
and the standard Python interpreter.
Home page: http://calcrpnpy.sourceforge.net/
Chang
Hi,
I do not know whether this is a Python, wxPython, Windows, or coding
question ...
I have a program that changes disk/directory using os.chdir (verified OK
with os.getcwd) then opens a file dialog box using wx.FileDialog with ""
as default dir.
I expected to be in my chdir directory but fo
ash wrote:
> hi,
> when i try to unpickle a pickled file in binary format, i get this
> error:
>
> E:\mdi>test.py
> Traceback (most recent call last):
> File "E:\mdi\qp.py", line 458, in OnReadButton
> data=p.load(file("ques.dat","r"))
> EOFError
>
> what is the reason? how do i overcome t
[EMAIL PROTECTED]
>>Oh no. That only means that namespace declaration attributes are not
>>created in the DOM data structure. However, output has to fix up
>>namespaces in .namespaceURI properties as well as directly asserted
>>"xmlns" attributes. It would be silly for DOM to produce malformed
>
hi,
when i try to unpickle a pickled file in binary format, i get this
error:
E:\mdi>test.py
Traceback (most recent call last):
File "E:\mdi\qp.py", line 458, in OnReadButton
data=p.load(file("ques.dat","r"))
EOFError
what is the reason? how do i overcome this?
Thanks in advance for you val
[EMAIL PROTECTED] wrote:
> Hello,
> I am using python and CGI to initiate a long running simulation (up to
> 5h long) on a remote machine. The main idea is that I use a form, enter
> the parameters and a CGI scripts start the simulation using these
> parameters. The structure of the script is:
>
>
Tony Meyer wrote:
> Thanks for that. In your opinion, would a documentation patch that
> explained that this would occur on Windows (after the existing note
> about the Windows rename not being atomic) be acceptable?
In principle, yes. We cannot do that for every platform, of course,
but it p
On Sat, 3 Dec 2005 22:32:22 +1300, Tony Meyer <[EMAIL PROTECTED]> wrote:
>On Windows, if I do os.rename(old, new) where old is a file that is
>in-use (e.g. python itself, or a dll that is loaded), I would expect
>that an error would be raised (e.g. as when os.remove is called with
>an in-use file)
Bengt Richter wrote:
> On 2 Dec 2005 18:34:12 -0800, [EMAIL PROTECTED] wrote:
>
> >
> >Bengt Richter wrote:
> >> It looks to me like itertools.groupby could get you close to what you want,
> >> e.g., (untested)
> >Ah, groupby. The generic string.split() equivalent. But the doc said
> >the input ne
On 2 Dec 2005 18:34:12 -0800, [EMAIL PROTECTED] wrote:
>
>Bengt Richter wrote:
>> It looks to me like itertools.groupby could get you close to what you want,
>> e.g., (untested)
>Ah, groupby. The generic string.split() equivalent. But the doc said
>the input needs to be sorted.
>
>>> seq = [3,1,
[Tony Meyer]
>> Is this the intended behaviour?
> [Martin v. Löwis]
> Sort-of. os.rename invokes the C library's rename, and does whatever
> this does. It is expected that most platform's C libraries do what
> the documentation says rename does, but platforms may vary in their
> implementation of
Tony Meyer wrote:
> Is this the intended behaviour?
Sort-of. os.rename invokes the C library's rename, and does whatever
this does. It is expected that most platform's C libraries do what
the documentation says rename does, but platforms may vary in their
implementation of the C library, and from
Uche <[EMAIL PROTECTED]> wrote:
> Of course. Minidom implements level 2 (thus the "NS" at the end of the
> method name), which means that its APIs should all be namespace aware.
> The bug is that writexml() and thus toxml() are not so.
Not exactly a bug - DOM Level 2 Core 1.1.8p2 explicitly leav
Scott David Daniels wrote:
> In reading over the source for CPython's PyUnicode_EncodeDecimal,
> I see a dance to handle characters which are neither dec-equiv nor
> in Latin-1. Does anyone know about the intent of such a conversion?
To support this:
>>> int(u"\N{DEVANAGARI DIGIT SEVEN}")
7
>
> "John Henry" <[EMAIL PROTECTED]> (JH) wrote:
>JH> I am looking for a Python tookit that will enable me to cut section of
>JH> a picture out from an EPS file and create another EPS file.
>JH> I am using a proprietary package for doing certain engineering
>JH> calculations. It creates single
On Windows, if I do os.rename(old, new) where old is a file that is
in-use (e.g. python itself, or a dll that is loaded), I would expect
that an error would be raised (e.g. as when os.remove is called with
an in-use file). However, what happens is that a copy of the file is
made, and the old file
> "Claudio Grondi" <[EMAIL PROTECTED]> wrote:
I don't know if it applies here, but in this context the extern keyword
> comes to my mind.
[snip extracts from Microsoft docs]
Perhaps. But I suspect it isn't that simple since ...
I'd think even if I don't use the extern keyword
[EMAIL PROTECTED] wrote:
> acc = []# accumulator ;)
> for line in fileinput.input():
> if condition(line):
> if acc:#1
> doSomething(acc)#1
> acc = []
> else:
> acc.append(line)
> if acc:#2
> doSomething(acc)#2
Looks like you'd be
Christopher Subich wrote:
>> anyone out there with an ILP64 system?
>
> I have access to an itanium system with a metric ton of memory. I
> -think- that the Python version is still only a 32-bit python
an ILP64 system is a system where int, long, and pointer are all 64 bits,
so a 32-bit python o
84 matches
Mail list logo