Wolfgang Rohdewald wrote:
> I want to match a string only if a word (C1 in this example) appears
> at most once in it.
def match(s):
if s.count("C1") > 1:
return None
return s
If this doesn't fit your requirements, you may want to provide some more
details.
Stefan
On Monday 05 October 2009, Carl Banks wrote:
> What you're not realizing is that if a regexp search comes to a
> dead end, it won't simply return "no match". Instead it'll throw
> away part of the match, and backtrack to a previously-matched
> variable-length subexpression, such as ".*?", and t
On Oct 4, 9:34 pm, Wolfgang Rohdewald wrote:
> Hi,
>
> I want to match a string only if a word (C1 in this example) appears
> at most once in it. This is what I tried:
>
> >>> re.match(r'(.*?C1)((?!.*C1))','C1b1b1b1 b3b3b3b3 C1C2C3').groups()
>
> ('C1b1b1b1 b3b3b3b3 C1', '')>>> re.match(r'(.*?C1)'
504cr...@gmail.com wrote:
> No -- sorry -- I don't want to use BeautifulSoup (though I have for
> other projects). Humor me, please -- I'd really like to see if this
> can be done with just regular expressions.
I think the reason why people are giving funny comments here is that you
failed to prov
hey friends just made a new blog will you comment it
http://makeing-money.blogspot.com/
--
http://mail.python.org/mailman/listinfo/python-list
Why not check it simply by "count()"?
>>> s = '1234C156789'
>>> s.count('C1')
1
>>>
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
I want to match a string only if a word (C1 in this example) appears
at most once in it. This is what I tried:
>>> re.match(r'(.*?C1)((?!.*C1))','C1b1b1b1 b3b3b3b3 C1C2C3').groups()
('C1b1b1b1 b3b3b3b3 C1', '')
>>> re.match(r'(.*?C1)','C1b1b1b1 b3b3b3b3 C1C2C3').groups()
('C1',)
but this sho
"Chris Rebert" wrote in message
news:50697b2c0910042047i1cf2c1a3mc388bc74bab95...@mail.gmail.com...
Tuples are immutable (i.e. they cannot be modified after creation) and
are created using parentheses.
Slight correction: tuples are created using commas. Parentheses are only
needed to disam
On Oct 4, 5:05 pm, Manowar wrote:
> Here is my question sekeltal animation ( bone animation) is it
> possible with python?
>>> "For God's sakes man!"[:-1]+'owar, use Blender!'
--
http://mail.python.org/mailman/listinfo/python-list
On Oct 4, 10:09 pm, flebber wrote:
> Hi
>
> Can someone clear up how I can remove all entries of a list when I am
> unsure how many entries there will be.
Sure...!
>>> a = range(10)
>>> a
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> del a[0]
>>> a
[1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> del a[-1]
>>> a
[1, 2, 3,
On Sun, Oct 4, 2009 at 8:09 PM, flebber wrote:
> Hi
>
> Can someone clear up how I can remove all entries of a list when I am
> unsure how many entries there will be. I have been using sandbox to
> play essentially I am creating two lists a and b I then want to add a
> to b and remove all b entrie
Hi
Can someone clear up how I can remove all entries of a list when I am
unsure how many entries there will be. I have been using sandbox to
play essentially I am creating two lists a and b I then want to add a
to b and remove all b entries. This will loop and b will receive new
entries add it to
[Paul Rubin]
> Example of list of trees (nested dicts). In practice you could get
> such a list from the simplejson module:
>
> list_of_trees = [{'value':1, 'left':{'value':3,'left':None,'right':None},
>'right':{'value':7,'left':{'value':5, ...}}},
>
On Sat, 03 Oct 2009 13:21:00 +, gb345 wrote:
> I'm relatively new to Python, and I'm trying to get the hang of
> using Python's subprocess module. As an exercise, I wrote the Tac
> class below, which can prints output to a file "in reverse order",
> by piping it through the Unix tac utility.
On Thu, 01 Oct 2009 22:10:55 -0700, 504cr...@gmail.com wrote:
> I'm kind of new to regular expressions
The most important thing to learn about regular expressions is to learn
what they can do, what they can't do, and what they can do in theory but
can't do in practice (usually because of exponent
Building on what others have said and giving a +1 to Carl:
I work daily in Maya doing character setup and rigging. As far as
doing it straight in Python, again, like others, take a look at PyGame
or Blender. I think the main question is: Do you want skeletal
animation, or do you want skeletal an
On Oct 4, 5:16 pm, Manowar wrote:
> On Oct 4, 6:38 pm, TerryP wrote:
>
> > On Oct 4, 10:05 pm, Manowar wrote:
>
> > > I am new to pyton and have asked this question several times the
> > > answer is always not sure.
> > > Here is my question sekeltal animation ( bone animation) is it
> > > possi
On Oct 5, 8:05 am, Manowar wrote:
> I am new to pyton and have asked this question several times the
> answer is always not sure.
> Here is my question sekeltal animation ( bone animation) is it
> possible with python? What i want to develop is an aquarium in
> realtime, skeletal animation, all th
On Oct 4, 6:38 pm, TerryP wrote:
> On Oct 4, 10:05 pm, Manowar wrote:
>
> > I am new to pyton and have asked this question several times the
> > answer is always not sure.
> > Here is my question sekeltal animation ( bone animation) is it
> > possible with python? What i want to develop is an aqu
thats because the standard way to build python packaged is to use
distutils, and not make files. Blame Yafaray for not supplying a
setup.py...
..M, Aahz wrote:
> In article ,
> namekuseijin wrote:
>>
>>and then I realize that, for whatever reason, the super popular and
>>trendy python DOESN'T
On Oct 4, 10:05 pm, Manowar wrote:
> I am new to pyton and have asked this question several times the
> answer is always not sure.
> Here is my question sekeltal animation ( bone animation) is it
> possible with python? What i want to develop is an aquarium in
> realtime, skeletal animation, all t
On Sun, 4 Oct 2009 13:18:22 -0400,
Simon Forman wrote:
> On Sun, Oct 4, 2009 at 5:29 AM, Martien Verbruggen
> wrote:
>> On Sun, 4 Oct 2009 01:17:18 + (UTC),
>> Grant Edwards wrote:
>>> On 2009-10-03, ryniek90 wrote:
>>>
So, whether it is or has been planned the core Pytho
I am new to pyton and have asked this question several times the
answer is always not sure.
Here is my question sekeltal animation ( bone animation) is it
possible with python? What i want to develop is an aquarium in
realtime, skeletal animation, all the movements will be from
programming., no key
On Oct 4, 7:38 pm, vasudevram wrote:
> Hi group,
>
> I'll update the README.txt file to correct that error soon.)
Done. Corrected README.txt uploaded (as part of updated zip file).
I forgot to mention, in the original post above, that both the client
and the server programs have top-level clas
horos11 wrote:
Anyways, maybe I got off to a bad start,
Blaming programming errors on non-existent bugs in the interpreter is
not a way to endear yourself.
And perhaps Python truly is not your style.
Maybe PyChecker or PyLint will help, I don't know.
I do not use them, but others swear
On Sun, 2009-10-04 at 09:17 -0700, dpapathanasiou wrote:
> > Which is *really* difficult (for me) to read. Any chance of providing a
> > "normal" traceback?
>
> File "/opt/server/smtp/smtps.py", line 213, in handle
> email_replier.post_reply(recipient_mbox, ''.join(data))
> File "/opt/ser
>
> Anyways, maybe I got off to a bad start, but I'm a bit leery of the
> language. In my estimation it's trying to be 'too clever by half', and
> this coming from a veteran bash/perl programmer. I mean, free form is
> one thing, but too much of a good thing can be harmful to your
> programming hea
On Oct 4, 9:47 am, Martin wrote:
> On Oct 3, 11:56 pm, Peter Otten <__pete...@web.de> wrote:
>
>
>
>
>
> > Martin wrote:
> > > Dear group
>
> > > I'm trying to use PIL to write an array (a NumPy array to be exact) to
> > > an image.
> > > Peace of cake, but it comes out looking strange.
>
> > > I
On 2009-10-04 10:48 AM, Stef Mientki wrote:
Steven D'Aprano wrote:
On Sat, 03 Oct 2009 10:24:13 +0200, Stef Mientki wrote:
I still don't use (because I don't fully understand them) packages, but
by trial and error I found a reasonable good working solution, with the
following specifications
Benjamin Kaplan wrote in news:mailman.838.1254682604.2807.python-
l...@python.org in comp.lang.python:
>> And how do you just check a script's syntax without running it
>> anyways?
>> )
>
> Because these aren't compile-time errors. Python has no compilation
> phase-
Sure it does, compilation ha
On Sun, Oct 4, 2009 at 2:44 PM, horos11 wrote:
>
>>
>> > Thanks for the info, but a couple of points:
>>
>> > 1. it wasn't meant to be production code, simply a way to teach
>> > python.
>>
>> Speaking as someone who does teach Python, "Ew, no!" If you start by
>> teaching people bad habits,
On Oct 4, 3:12 am, Albert Hopkins wrote:
> * You define a to_string() method. To have a string representation
> of a class, one usually defines a __str__ method. This gives
> the advantage whereby "print myobject" or '%s' % myjobject just
> work.
In fairness, a lot
On Oct 4, 11:56 am, Benjamin Kaplan wrote:
> On Sun, Oct 4, 2009 at 2:44 PM, horos11 wrote:
>
> > (
> > ps - an aside, but what was the rationale behind only displaying one
> > error at a time on trying to run a script? I typically like to run a
> > compilation phase inside my editor (vim), get a
On Sun, Oct 4, 2009 at 2:44 PM, horos11 wrote:
>
>>
>> > Thanks for the info, but a couple of points:
>>
>> > 1. it wasn't meant to be production code, simply a way to teach
>> > python.
>>
>> Speaking as someone who does teach Python, "Ew, no!" If you start by
>> teaching people bad habits,
>
> > Thanks for the info, but a couple of points:
>
> > 1. it wasn't meant to be production code, simply a way to teach
> > python.
>
> Speaking as someone who does teach Python, "Ew, no!" If you start by
> teaching people bad habits, every educator who comes along afterwards
> will curse yo
> Is there any chance of getting some of the devs or anyone familiar
> enough with the source code to make this possibility become reality?
Please take a look at
http://bugs.python.org/issue4709
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 04 Oct 2009 07:37:35 -0500, Bernie wrote:
> On Sat, 03 Oct 2009 20:09:18 -0700, TerryP wrote:
>
>> On Oct 3, 4:29 pm, Bernie wrote:
>>> Hi, no -its just put on the website. Unless there's a method you can
>>> suggest?
>>
>> Not to butt in, but off the top of my head, you could probably
On Sun, Oct 4, 2009 at 1:12 AM, horos11 wrote:
>
>> >>> a
>>
>> <__main__.Myclass instance at 0x95cd3ec b
>>
>> <__main__.Myclass instance at 0x95cd5ac>
>>
>> What's the problem?
>
> Like I said, the code was a sample of what I was trying to do, not the
> entire thing.. I just wanted to see if
On Sun, Oct 4, 2009 at 5:29 AM, Martien Verbruggen
wrote:
> On Sun, 4 Oct 2009 01:17:18 + (UTC),
> Grant Edwards wrote:
>> On 2009-10-03, ryniek90 wrote:
>>
>>> So, whether it is or has been planned the core Python
>>> implementation of *scanf()* ?
>>
>> One of the fist things I remem
On Sun, Oct 4, 2009 at 2:29 AM, horos11 wrote:
> All,
>
> Another one, this time a bit shorter.
>
> It looks like defaults for arguments are only bound once, and every
> subsequent call reuses the first reference created. Hence the
> following will print '[10,2]' instead of the expected '[1,2]'.
>
> Which is *really* difficult (for me) to read. Any chance of providing a
> "normal" traceback?
File "/opt/server/smtp/smtps.py", line 213, in handle
email_replier.post_reply(recipient_mbox, ''.join(data))
File "/opt/server/smtp/email_replier.py", line 108, in post_reply
save_attachm
On Oct 4, 4:47 pm, Benjamin Kaplan wrote:
> Looks like it's a Python problem, not Ubuntu's.
That's correct, it's a Python problem. A fix has been checked in on
the release26-maint branch (which means that it should be available in
2.6.4) and a unit test added to catch this case in the future.
It
On Sun, 2009-10-04 at 08:16 -0700, dpapathanasiou wrote:
> > And where might we be able to see that stack trace?
>
> This is it:
>
> Exception: ('AttributeError', '', [' File "/opt/server/smtp/
> smtps.py", line 213, in handle\ne
> mail_replier.post_reply(recipient_mbox, \'\'.join(data))\n',
Steven D'Aprano wrote:
On Sat, 03 Oct 2009 10:24:13 +0200, Stef Mientki wrote:
I still don't use (because I don't fully understand them) packages, but
by trial and error I found a reasonable good working solution, with the
following specifications
I find that fascinating. You haven't
I can confirm this in Python 2.6.3 for Windows and Mac while it
doesn't appear in Python 2.6.2 on Windows or the system Python 2.6.1
in Snow Leopard.
Looks like it's a Python problem, not Ubuntu's.
On Sun, Oct 4, 2009 at 3:31 AM, Valery wrote:
> OK, I've filed a bug. Because Python2.5 works fine
> And where might we be able to see that stack trace?
This is it:
Exception: ('AttributeError', '', [' File "/opt/server/smtp/
smtps.py", line 213, in handle\ne
mail_replier.post_reply(recipient_mbox, \'\'.join(data))\n', ' File "/
opt/server/smtp/email_replier.py", l
ine 108, in post_repl
In article ,
namekuseijin wrote:
>
>and then I realize that, for whatever reason, the super popular and
>trendy python DOESN'T FRIGGIN BUILD SHARED LIBS BY DEFAULT!
I've got a dim memory that there's a reason for this -- you might try
searching the python-dev archives and/or bugs.python.org.
--
Just answering my own question
A little googling tells me to use
(cmd (format "exec(compile(open('%s').read(), '%s', 'exec')) #
PYTHON-MODE\n" filename filename)))
instead of
(cmd (format "exec(open(r'%s').read()) # PYTHON-MODE\n" filename)))
sheesh!
On Sun, Oct 4, 2009 at 6:57 PM, Rustom Mody
On Sun, 2009-10-04 at 07:27 -0700, dpapathanasiou wrote:
> When I try to write the filedata to a file system folder, though, I
> get an AttributeError in the stack trace.
And where might we be able to see that stack trace?
-a
--
http://mail.python.org/mailman/listinfo/python-list
Hi group,
I've released a software package named PDFXMLRPC. It consists of a
server and a client. Using them, you can do client-server PDF creation
from text, over the Internet or your intranet. It runs over XML-RPC
and uses HTTP as the transport. It can work with any available port,
including th
I'm using python to access an email account via POP, then for each
incoming message, save any attachments.
This is the function which scans the message for attachments:
def save_attachments (local_folder, msg_text):
"""Scan the email message text and save the attachments (if any)
in the local
Removing execfile from python3 has broken the good-ol python-mode of emacs.
Changing the line
In python-mode.el in function py-execute-file changing the line
(cmd (format "execfile(r'%s') # PYTHON-MODE\n" filename)))
to
(cmd (format "exec(open(r'%s').read()) # PYTHON-MODE\n" filename)))
seems
Jon Clements wrote:
> On Oct 4, 12:08 pm, n00m wrote:
>> Duncan Booth,
>>
>> alas... still TLE:
>>
>> 2800839
>> 2009-10-04 13:03:59
>> Q
>> Enormous Input and Output Test
>> time limit exceeded
>> -
>> 88M
>> PYTH
>
> Just to throw into the mix...
>
> What about buffering? Does anyone know wh
On Sat, 03 Oct 2009 20:09:18 -0700, TerryP wrote:
> On Oct 3, 4:29 pm, Bernie wrote:
>> Hi, no -its just put on the website. Unless there's a method you can
>> suggest?
>
> Not to butt in, but off the top of my head, you could probably set up a
> mailing list and post the link to the file every
On Sun, 04 Oct 2009 07:14:08 +0100, horos11 wrote:
Carl,
Thanks for the info, but a couple of points:
1. it wasn't meant to be production code, simply a way to teach
python.
Speaking as someone who does teach Python, "Ew, no!" If you start by
teaching people bad habits, every educator
On Oct 4, 12:08 pm, n00m wrote:
> Duncan Booth,
>
> alas... still TLE:
>
> 2800839
> 2009-10-04 13:03:59
> Q
> Enormous Input and Output Test
> time limit exceeded
> -
> 88M
> PYTH
Just to throw into the mix...
What about buffering? Does anyone know what the effective stdin buffer
is for Python?
n00m wrote:
>
> I've given up :-)
Here's my attempt, which is about 30% faster than your original but I've no
idea if it would be fast enough for you.
import sys, time, os, itertools
import gc
gc.set_threshold()
D = []
def foo():
##sys.stdin = open('D:/1583.txt', 'rt')
count = int
Just by a brief look at your code snippet there are a few things that I
would point out, stylistically, that you may consider changing in your
code as they are generally not considered "pythonic":
* As already mentioned the "state" class is best if given a name
that is capitalized.
Terry Reedy:
> Don't waste your time with problem sites that judge raw-clock time over
> (and before) accuracy, thereby greatly favoring low-level languages and
> hack tricks over clear high-level code.
I usually don't like to solve the kind of problems shown by those
sites because those problems
On Sun, 4 Oct 2009 01:17:18 + (UTC),
Grant Edwards wrote:
> On 2009-10-03, ryniek90 wrote:
>
>> So, whether it is or has been planned the core Python
>> implementation of *scanf()* ?
>
> One of the fist things I remember being taught as a C progrmmer
> was to never use scanf. Program
John Nagle schrieb:
> Shaun wrote:
>> I'm trying to create a dictionary with lists as the value for each
>> key.
>
>Try using a tuple, instead of a list, for each key. Tuples
> are immutable, so there's no issue about a key changing while
> being used in a dictionary.
Only if Shaun wanted to
On Oct 4, 4:20 am, n00m wrote:
> I've given up :-)
Well, that numerix user (who already had the top Python solution) just
submitted a ton of new ones to that problem, apparently trying to get
a faster time. I don't think he can squeeze much more out of that
stone, but unlike us, he's routinely u
On Oct 3, 11:56 pm, Peter Otten <__pete...@web.de> wrote:
> Martin wrote:
> > Dear group
>
> > I'm trying to use PIL to write an array (a NumPy array to be exact) to
> > an image.
> > Peace of cake, but it comes out looking strange.
>
> > I use the below mini code, that I wrote for the purpose. The
On Oct 2, 4:54 am, Ole Streicher wrote:
> Hi group,
>
> I am trying to use a weak reference to a bound method:
>
> class MyClass(object):
> def myfunc(self):
> pass
>
> o = MyClass()
> print o.myfunc
>
> >
>
> import weakref
> r = weakref.ref(o.myfunc)
> print r()
>
> Non
It can be not so "simple".
There can be multiple input files,
with *total* size ~30-50-80 MB.
--
http://mail.python.org/mailman/listinfo/python-list
This time limits too:
=
import psyco
psyco.full()
import sys
def foo():
##sys.stdin = open('D:/1583.txt', 'rt')
a = sys.stdin.readlines()
a = a[1:int(a[0]) + 1]
for ai in a:
x, y = ai.split()
sys.stdout.write(str
PS
Yes, they support psyco since long time ago
(otherwise I'd get Compilitation Error verdict).
I used Psyco there many many times.
--
http://mail.python.org/mailman/listinfo/python-list
Okay that makes sense. I was assuming that list.append returned the
new list.
thanks
--
http://mail.python.org/mailman/listinfo/python-list
On Oct 4, 1:50 am, n00m wrote:
> It can be not so "simple".
> There can be multiple input files,
> with *total* size ~30-50-80 MB.
According to one of the global moderators, the 20s time limit is for
each input file:
https://www.spoj.pl/forum/viewtopic.php?f=6&t=4667
John
--
http://mail.pyth
I've given up :-)
--
http://mail.python.org/mailman/listinfo/python-list
I work with the Mingw-w64 Project, and am the project owner of WPG
System64 (you can find out about both at http://www.cadforte.com),
which contains Python.org Python 2.6.2. I haven't used Python 3.1.1
because I have seen errors with "print" occur in several places, but
that is another topic (I am
On Oct 3, 11:45 pm, horos11 wrote:
> > It's not a bug. In Python classes and global variables share the same
> > namespace.
>
> > Don't you think you should learn a bit more about how Python manages
> > objects and namespaces before going around calling things bugs?
>
> > Carl Banks
>
> No, I don
On Sunday, 4 October 2009 08:14:08 horos11 wrote:
> Saying that 'whoa, this coding error should be handled by naming
> convention' may be the only practical way of getting around this
> limitation, but it is a limitation nonetheless, and a pretty big one.
You misunderstand the dynamic nature of p
OK, I've filed a bug. Because Python2.5 works fine here.
--
Valery
--
http://mail.python.org/mailman/listinfo/python-list
horos11 wrote:
Carl,
Thanks for the info, but a couple of points:
1. it wasn't meant to be production code, simply a way to teach
python.
2. this should either be a compile time or a runtime error.
'Actions at a distance' like this are deadly both to productivity and
to correctness -
Hi all
is it a pure Ubuntu Karmic (beta) issue?..
$ python
Python 2.6.3 (r263:75183, Oct 3 2009, 11:20:50)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from logging import *
Traceback (most recent call last):
File "", line 1, in
AttributeErr
On Oct 3, 11:14 pm, horos11 wrote:
> Carl,
>
> Thanks for the info, but a couple of points:
>
> 1. it wasn't meant to be production code, simply a way to teach
> python.
I understand, and if you think it's overkill for your pedagogical
application then feel free not to follow the suggestions
77 matches
Mail list logo