Paul Rubin wrote:
> "Case Nelson" <[EMAIL PROTECTED]> writes:
> > Basically, the program needs to take in a random list of no more
than
> > 10 letters, and find all possible mutations that match a word in
my
> > dictionary (80k words). However a wildcard letter '?' is also an
> > acceptable char
To search for a word which is a jumble of a given set of characters in a
(sizable) lexicon, see this posting:
http://blog.vrplumber.com/427
your alterations would be to check for length == to length -
number-of-wildcards (with the wildcards removed from the translation
table, of course) and
t here's an answer
> anyway
Heh, it's been awhile since I took data structures 101 but I asked here
after reading about python generators, and although I can't quite get
my head around them, I have a sense that they could help me check all
mutations (is this the right word?) of the c
Mike,
Thanks, this worked great, and was 4x faster than my method!
Thanks everyone for replying!
The changes I made were:
!rest = ''.join([chr(i) for i in range(256) if chr(i).upper() not in
WORD])
!# a wildcard in the word means that we check all letters
!if '?' in WORD:
!rest = ''
!trans
>>>>> "Case" == Case Nelson <[EMAIL PROTECTED]> writes:
> Hi there I've just been playing around with some python code and I've
> got a fun little optimization problem I could use some help with.
> Basically, the program needs to take in a rando
Hi Case.
Just in case you're really, truly looking for a fast Scrabble
word-search algorithm, the classic AI/CS article here is:
Andrew W. Appel and Guy J. Jacobson, The world's fastest Scrabble
program, Communications of the ACM, 31(5), pp 572--578, May 1988.
You can find a copy of this article
Paul Rubin wrote:
"Case Nelson" <[EMAIL PROTECTED]> writes:
Basically, the program needs to take in a random list of no more than
10 letters, and find all possible mutations that match a word in my
dictionary (80k words). However a wildcard letter '?' is also an
acceptable character which increas
paul that is awesome so much better than what i did which was lamo
brute force method. I formmatted and reformatted my input data and
stuffed it in a HUGE dictionary it was stupid and kludgy i hope
to study all these approaches and learn something here's what i
came up with ... with
With a list of letters: 'ABAE?S?' your implementation ran 3.5 times
faster than the one from http://blog.vrplumber.com/427 (in 0.437
seconds vs 1.515)
Without wildcards yours runs slightly quicker as well.
I guess with the wildcards, using an re as a quick filter against each
word, versus the tra
On 21 Jan 2005 05:58:03 -0800
[EMAIL PROTECTED] (Joh) wrote:
> i'm trying to understand how i could build following consecutive sets
> from a root one using generator :
>
> l = [1,2,3,4]
>
> would like to produce :
>
> [1,2], [2,3], [3,4], [1,2,3], [2,3,4]
>>> def consecutive_sets(l):
...
Joh wrote:
hello,
i'm trying to understand how i could build following consecutive sets
from a root one using generator :
l = [1,2,3,4]
would like to produce :
[1,2], [2,3], [3,4], [1,2,3], [2,3,4]
Do you mean:
[1,2], [2,3], [3,4], [1,2,3], [2,3,4], [1,3,4]
(E.g. all elements in the power set e
On Fri, 2005-01-21 at 17:14 +0300, Denis S. Otkidach wrote:
> On 21 Jan 2005 05:58:03 -0800
> [EMAIL PROTECTED] (Joh) wrote:
>
> > i'm trying to understand how i could build following consecutive sets
> > from a root one using generator :
> >
> > l = [1,2,3,4]
> >
> > would like to produce :
> >
On Fri, 2005-01-21 at 22:38 +0800, Craig Ringer wrote:
> consecutive_sets = ( x[offset:offset+subset_size]
> for subset_size in xrange(2, len(x))
> for offset in xrange(0, len(x) + 1 - subset_size) )
Where 'x' is list to operate on, as I should've initial
by using sub generator
> and maybe enumerate, please if you help could you explain a bit the
> trick ? looks like this sub generator thing mess me up.
Here is an (untested) variant that accepts any iterable while trying to
remain memory-efficient. This makes it necessary to shuffle the o
Le vendredi 21 Janvier 2005 16:06, Craig Ringer a ÃcritÂ:
> On Fri, 2005-01-21 at 22:38 +0800, Craig Ringer wrote:
> > consecutive_sets = ( x[offset:offset+subset_size]
> > for subset_size in xrange(2, len(x))
> > for offset in xrange(0, len(x) + 1 - subset
On Fri, 2005-01-21 at 16:54 +0100, Francis Girard wrote:
> First, I think that you mean :
>
> consecutive_sets = [ x[offset:offset+subset_size]
> for subset_size in xrange(2, len(x))
> for offset in xrange(0, len(x) + 1 - subset_size)]
>
> (with square
Thank you,
I immediately download version 2.4, switching from version 2.3.
Francis Girard
FRANCE
Le vendredi 21 Janvier 2005 17:34, Craig Ringer a ÃcritÂ:
> On Fri, 2005-01-21 at 16:54 +0100, Francis Girard wrote:
> > First, I think that you mean :
> >
> > consecutive_sets = [ x[offset:offset+su
uld do? I would go on Sourceforge. Try to find a
project that seems interestingto you. and then contact the Maintainer
see if you can help.
Many project also advertise the kind of help they need.
--
Steve Menard
Maintainer of http://jpype.sourceforge.net
--
http://mail.pyt
Georg Brandl wrote:
Hello,
to train my Python skills I am looking for some project I can contribute
to. I learned Python about one year ago, and had already some
programming background behind (I contributed to SharpDevelop for
instance), so I'm not the complete newbie.
About myself: I'm a 20 year o
Hello Chap,
I work on various projects. Several of them would *greatly* benefit
from input from another programmer. You can see them at :
http://www.voidspace.org.uk/python/index.shtml
Specifically, I have three projects that I'm looking for someone to
work on, but they are all on the 'small' sc
Title: RE: Help on project, anyone?
[Georg Brandl]
#- Does anyone run, or participate in, a project looking for fellow
#- programmers? I don't have a special area of interest, well,
#- perhaps web
#- programming...
You can join us in SiGeFi: http://sf.net/projects/s
hello,
thanks to all who replied to my post (2005-01-21) - (i can not post
inside the original thread as i get "Unable to retrieve message
[EMAIL PROTECTED]" from googlenews :(
> Do you mean:
> [1,2], [2,3], [3,4], [1,2,3], [2,3,4], [1,3,4]
> (E.g. all elements in the power set except the empty s
Hello Fuzzyman,
> 3) Simple Version Control program for single programmer. A very simple
> way of doing version control/releases for small projects with only a
> single programmer. [3]
Subversion (and CVS) are dead simple to install and use.
IMO in the long run you'll find yourself implementing mo
Miki Tebeka wrote:
> Hello Fuzzyman,
>
> > 3) Simple Version Control program for single programmer. A very
simple
> > way of doing version control/releases for small projects with only
a
> > single programmer. [3]
> Subversion (and CVS) are dead simple to install and use.
I've heard *lots* of peo
27;t have a special area of interest, well, perhaps web
> programming...
>
> Thanks,
> Georg
Well, if you want to help, I've got a project that has been a python
learning experience for me, and it has *lots* of potential ( read: very
poor code and implementation ;-) ).
Ba
Fuzzyman wrote:
>
> Miki Tebeka wrote:
>> Hello Fuzzyman,
>>
>> > 3) Simple Version Control program for single programmer. A very
> simple
>> > way of doing version control/releases for small projects with only
> a
>> > single programmer. [3]
>> Subversion (and CVS) are dead simple to install and
I don't know how complicated that you want to get, but Zope has
built in support for a control panel with what are called portlets.
Each portlet can act as an individual sub-window on the control
panel. You convert each of your individal scripts to a portlet
and plug them into a control panel page
Ifd you want to use standard CGI I've written a CGI user
authentication/management module called logintools.
See http://www.voidspace.org.uk/python/logintools.html
Regards,
Fuzzy
http://www.voidspace.org.uk/python/index.shtml
--
http://mail.python.org/mailman/listinfo/python-list
possible, I think it would be nice if the security aspect of it was
already built-in so I would not need to write/test it myself.
Thanks for your help.
--
http://mail.python.org/mailman/listinfo/python-list
application server
> (ie. Zope or Webware)?
>
> If possible, I think it would be nice if the security aspect of it
was
> already built-in so I would not need to write/test it myself.
>
> Thanks for your help.
For simple applications, writing CGIs is going to be quite a lot easier
than
recent call last):
File "Build.py", line 823, in ?
build(sys.argv[1])
File "Build.py", line 25, in build
rthooks = eval(open(os.path.join(HOMEPATH, 'rthooks.dat'),
'r').read())
File "", line 1
{
^
SyntaxError: invalid syntax
What is this
Ok, this is my problem:
With code below I get a red box with given width and height. When I
use that create_image, nothing happens. I only see that same red box.
Why is that?
The loop.bmp is working fine when I use show() method.
win = Toplevel()
canvas = Canvas(win, width=100, h
If you are using ipython on Windows then you will
have made sure you have Gary Bishop's readline
library as instructed in the ipython install
directions found at:
http://ipython.scipy.org/
Even if you use the standard commandline tool,
installing readline makes the basic command line a
lot eas
Hi,
I got a strange error of my python program. The
program is trying to load some data from server (also
built in Python). the data is in xml format. After
calling xml parser, I got the following error:
File "ShowAll.py", line 156, in ?
main(sys.argv)
File "ShowAll.py", line 129, in ma
Jochen Kaechelin wrote:
I run debian sid and apache2 with libapache2-mod-python2.3
and I added these lines
AddHandler mod_python .py
PythonDebug On
in a virtualhost container.
Were those the only lines you added? You also should have actually
loaded the module somewhere by adding something
Am Mittwoch, 23. Februar 2005 00:29 schrieb Brian Beck:
> Jochen Kaechelin wrote:
> > I run debian sid and apache2 with libapache2-mod-python2.3
> > and I added these lines
> >
> >
> >AddHandler mod_python .py
> >PythonDebug On
> >
> >
> > in a virtualhost container.
>
> Were those the on
code but am running into a problem.
> Whenever I try to debug my program or run any code past the following code
> it gets hung up and crashes, quits, no warning, and no messages. HELP,
> what
> is the problem, it is getting very frustrating.
>
>>> import win32com.client
27;\r' '\n' | tr \' \" | sed -n
's/.*url="\([^"]*\)".*/\1/p'
I want to use the above code in my program by using popen2 so i can query
the results i.e.
output, input = popen2("the code here")
print output
Any help would be apprec
enter a number at the beginning,
asking you how many characters you want.
anyone out there who could help us?
also i wonder how i can read the current date/time (we don't understand
datetime() )and put it into a variable and print that variable?
[mx] and Tschabo
doing python since yesterda
Eduardo Suarez wrote:
I'm trying to set the python path variable so i can use them, but i
haven't got it. Any hint?
sys.path.append('/usr/blah/blah/blah/directory')
--
http://mail.python.org/mailman/listinfo/python-list
Eduardo Suarez wrote:
In order not to make a mess my system, i have installed a packaged
called pygtkglext in /usr/local/pygtkglext instead of /usr/local (using
the --prefix in ./configure).
Hence, i have the directories
/usr/local/pygtkglext-1.0.1/lib/python2.3/site-packages/gtk-2.0/gtk/gtkgl
/
What do i need to add to the path? I have already tried the same with
the PYTHONPATH variable.
Thanks in advance,
-Eduardo
[otto:eduardo/ 501]$ python
Python 2.3.5 (#2, Feb 9 2005, 00:38:15)
[GCC 3.3.5 (Debian 1:3.3.5-8)] on linux2
Type "help", "copyright", "credi
Hi,
people here usually tend not to be too helpful when asked to do an obvious
homework task. So if you really want help, provide some code you've already
written and that has actual problems. Then we're glad to help. But don't
expect others to do your work.
--
Regards,
D
Thank both for the help. I understand that I should provide code, I am
still trying to understand what to do, I don't want the work done, just
some ideas of where to go, a general layout perhaps. Thank you.
--
http://mail.python.org/mailman/listinfo/python-list
This is just a basic of what I have so far. The time , a class I will need
and the print function.
class Account:
def __init__(self, initial):
self.balance = initial
def deposit(self, amt):
self.balance = self.balance + amt
def withdraw(self,amt):
self.ba
> import warnings
> warnings.warn('foo')
>
> % python t.py
> t.py:2: UserWarning: foo
> warnings.warn('foo')
>
> Is there a way to just issue the warning message itself, or to at
least
> suppress printing the line where the warning occurred ("
> warnings.warn('foo')" in the example)?
In case any
Greg Lindstrom wrote:
I've been running python for years and have never had trouble installing
until today. I am trying to install Python 2.3.5 from python.org on my
windows 2000 box. I uninstalled everything from the previous Python,
downloaded and ran the exe and everything appeared to run c
ype "python" I am told it doesn't know that that
> is! The file association with seems to work. Do I need to map the PATH
> myself? Everything's in the default directory (C:\Python23).
>
> Thanks for your help,
> --greg
>
> --
> Greg Lindstrom
[Peter Hansen wrote]
> Python has never (as far as I know) set up the PATH during
> installation.
I think that's true of the python.org installer. ActivePython will add
the install directory to your PATH.
Trent
--
Trent Mick
[EMAIL PROTECTED]
--
http://mail.python.org/mailman/listinfo/python-l
Hello all, I am still needing some help on this code, I have gone a bit
further on it. Thank you for the help. I am trying to understand how to
make the file searchable and how I am to make the deposit and withdrawl
interact with the transaction class.
class Account:
def __init__(self
Hi
I had downloaded
python-2.4.msi and I have Windows Installer V2.00.2600.2 on my machine (my OS is
Win 2K Professional). But every time I try to run python-2.4.msi I am getting
the error message: "This installation package could not be
opened..." I am a newsier in python, I would be grate
I don't know why i entered the below code and it will miss some
records.
Anyone can help me???
users = {}
users1 = {}
while 1:
user, serviceType, msgType, inOut, date, time, numBytes =
aLog.GetNextMessage("")
fullmsg = serviceType + "|" + msgType + &q
__init__(self, name, age):
... self.name = name
... self.age = age
...
>>>
>>> students = [Student('John', 18), Student('Jill', 17)]
>>> students.sort(lambda x,y: cmp(x.age, y.age))
>>> [student.name for stude
This is a follow up question
To the previous question
About sorting that
I sent for my friend.
-Original Message-
From: Tan, Heap Ho
Sent: Tuesday, March 22, 2005 2:06 PM
To: Leeds, Mark
Subject: RE: FW: Python help group
How can you speed it? Does anyone know if
for more information.
Leeds, Mark wrote:
Can someone
help me with below ?
It’s not my
question but I will
forward any
answers to my friend
who I am
sending this for.
Mark
-Original
Message-
From: Tan, Heap
BMS wrote:
> I'll apreciate if you can guide me how to sort in Python. I'm doing a
> list and I want to sort it in ascending or descending order.
>
> Please send me some examples.
Everything you need is right here:
http://www.catb.org/~esr/faqs/smart-questions.html
http://www.python.org/doc/
T
Ron wrote:
Is this built into any of the python versions? Need it! Using 2.3.5 and
doesn't seem to have it.Newbe needs help!email[EMAIL PROTECTED] Thanks Ron
PySerial has never been built in to any standard v
distribution of Python, but it's an easy download
and the web page is
Just give (as root)
# urpmi python-devel
(assuming you have configured urpmi properly, Google
for "easy urpmi").
Michele Simionato
--
http://mail.python.org/mailman/listinfo/python-list
* Michele Simionato wrote:
> Just give (as root)
>
> # urpmi python-devel
The OP mentioned that urpmi couldn't find a package by that name. So it
might be worth querying for "libpython" if that fails:
[EMAIL PROTECTED] urpmq libpython
The following packages contain libpython:
libpython2.3
libpyth
Am Montag, 4. April 2005 20:54 schrieb John Ridley:
> The OP mentioned that urpmi couldn't find a package by that name. So it
> might be worth querying for "libpython" if that fails:
This is why why I don't use a binary distribution... :-) (Differences in)
Naming makes getting at devel-packages a
On 2005-04-09, Adriano Monteiro <[EMAIL PROTECTED]> wrote:
> I need to talk to my modem through a terminal, so I can send
> commands and get the answers.
Through a terminal? Just type on the keyboard and look at the
display.
> Does anybody here know what can I do?
Not unless you can clearly de
using "from wxPython.wx import *" under python2.3 I cannot seem to find the
wxGrid class -- it says its undefined -- am I missing something obvious ? I
know the globalspace import is not the best, but that how I got started
;) -- any help owuld be appreciated
--
http://mail.python.o
monocalibro wrote:
Hello all!
I need ready-for-use installable version of PySparse (for FiPy), because I
can't compile it with MingW. Or, may be, somebody knows step-by-step
instruction to complie this package under Win32 using Mingw?
Best regards
At least describe the web site you got it from, th
Dear All
I am very new to python . i would appreciate any help from you all on
this problem which i am facing.
I am trying to connect to postgres from python.for this i am using
something like " import pgdb". i am able to connect to postgres and
fetch data , if i execute the python fil
Fabien:
> There is a lexPOV.cxx file in the package, but I can not find any POV
> keywords in any file ( there are about 150 POV keywords). Did i miss it,
> and if not, how do I create one and include it for the library building ?
The Scintilla web site, documentation and mailing list are:
h
fabien wrote on Sun, 01 May 2005 05:40:05 -0700:
> Hi,
Hello Fabien
> I am writing a POV-RAY editor with Python using
> either QT or GTK as GUI 'wrapper'. ( I am still trying both )
>
> [snip]
>
> I have also downloaded qscintilla-1.62-gpl-1.5.1.
> As for GTK, I also found the LexPOV.cpp file, w
Hi
I am writing a program that allows a user to annotate text documents,
and later html, html variants, and PDF files. My program is able to
load multiple documents at once and creat linked anotations between
these documents. Therefore i want to create a custom system to save the
files. Ideally I
Neil Hodgson wrote:
> Fabien:
>
>
>>There is a lexPOV.cxx file in the package, but I can not find any POV
>>keywords in any file ( there are about 150 POV keywords). Did i miss it,
>>and if not, how do I create one and include it for the library building ?
>
>
>The Scintilla web site, doc
John Ridley wrote:
> fabien wrote on Sun, 01 May 2005 05:40:05 -0700:
>
Hello John,
>
>>Hi,
>
>
> Hello Fabien
>
>
>>I am writing a POV-RAY editor with Python using
>>either QT or GTK as GUI 'wrapper'. ( I am still trying both )
>>
>>[snip]
>>
>>I have also downloaded qscintilla-1.62-gpl-1.5.
See mr Martellis comment of 2001/09/06 in mentiond recipe, you then get
something like this
-#!/usr/bin/env python
-class Borg(object):
-_shared_state = {}
-def __init__(self):
-self.__dict__ = self._shared_state
-
-class Duck(Borg):
-def __init__(self):
-super(Duck, se
On Sat, 07 May 2005 08:35:21 -0700, [EMAIL PROTECTED] wrote:
> See mr Martellis comment of 2001/09/06 in mentiond recipe, you then get
> something like this
>
> -#!/usr/bin/env python
> -class Borg(object):
> -_shared_state = {}
> -def __init__(self):
> -self.__dict__ = self._shar
r.
>
>I now see why Ducks and Rabbits are sharing state: they both share the
>same __dict__ as all Borg instances. But I don't see how to get the
>behaviour I want. (Except by cutting and pasting the Borg code into each
>one.) Can anyone help?
>
If you are using old-style clas
#1, Mar 3 2005, 17:32:12)
[GCC 3.4.3 (Gentoo Linux 3.4.3, ssp-3.4.3-0, pie-8.7.6.6)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> def makeBorg():
... class Borg(object):
... _shared_state = {}
.
On Sun, 08 May 2005 02:42:09 +1000, Steven D'Aprano <[EMAIL PROTECTED]> wrote:
>On Sat, 07 May 2005 08:35:21 -0700, [EMAIL PROTECTED] wrote:
>
>> See mr Martellis comment of 2001/09/06 in mentiond recipe, you then get
>> something like this
>>
>> -#!/usr/bin/env python
>> -class Borg(object):
>>
On Sat, 07 May 2005 22:28:34 +1000, Steven D'Aprano wrote:
> I've been working with the Borg design pattern from here:
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66531
Thanks to everyone who took the time to answer. I've learnt a lot from the
discussion, not the least of which was
Im trying to grab a colum of data from a text file and write it to a new
file.
I am having trouble getting It to write the data to newlines. Python is
making it one
Long string without any spaces when it writes the file. The first
character is capitalized in colum 2.
I am trying to grab the 2nd co
xt\n")?
On the strict wxPython front, I can't help
you, but I might be able to offer some help.
Depends a little bit on how much you're tied
to wxPython and how much you need to be cross-platform.
Essentially, if you're on Windows (and have no need
to run on an
se...
>
> Anyone can give me an hint on how to easily and simply print some text? Is
> there a library ready to download and use? Something like SendPrinter("some
> text\n")?
>
> Thanks in advance if anyone can give any help.
>
> Mario
>
> --
> http://mai
cgi/Printing but
> is impossible to use this script even if I do exactly as said there. I think
> the script is buggy or I am not able to use it, even if seems very simple to
> use...
>
> Anyone can give me an hint on how to easily and simply print some text? Is
> there a library ready to download and use? Something like SendPrinter("some
> text\n")?
>
> Thanks in advance if anyone can give any help.
>
> Mario
>
>
--
http://mail.python.org/mailman/listinfo/python-list
"Tim G" <[EMAIL PROTECTED]> wrote:
> Essentially, if you're on Windows (and have no need
> to run on anything else) then consider some of the
> solutions here:
>
> http://tgolden.sc.sabren.com/python/win32_how_do_i/print.html
That was exactly what I needed! Thanks SO MUCH! :) I tested all the
dif
his can point you in the proper direction.
Thank you very much for the help, I will study all the code that you sent me
for a future and a more professional programming, for now I used a very
simple win32api call, not very evolved but working fine for what I needed,
since what I am doing needs to run onl
"James Carroll" <[EMAIL PROTECTED]> wrote:
>I especially like the HtmlEasyPrinting write-up here:
> http://wiki.wxpython.org/index.cgi/Printing
Thank you for your suggestion but I'm just not able to make it work, as i
said on the original post, I do exactly what is wrote there, but it gives
err
James Carroll <[EMAIL PROTECTED]> writes:
> If you are doing this just for yourself, and you know you have a
> printer that will really print just the plain text when you send it
> plain text (like a dot matrix printer from the early 90s) then you can
> probably open the printer device and send it
On Thursday 12 May 2005 04:56 am, Mike Meyer wrote:
> James Carroll <[EMAIL PROTECTED]> writes:
> > If you are doing this just for yourself, and you know you have a
> > printer that will really print just the plain text when you send it
> > plain text (like a dot matrix printer from the early 90s)
jeff elkins <[EMAIL PROTECTED]> writes:
>> Instead, as was suggested earlier, use the "lpr" command and send it
>> the text/data on standard input. Any reasonably managed Unix system
>> should be able to handle a fair range of graphics formats, though
>> postscript is preferred.
> I've been using:
There's a working version in the wxPython Demo...
If you run the wxpython demo, and choose Print Framework under
Miscellaneous it has code that looks a whole lot like what's on the
wiki, only you can test it and try it out and see if it's broken for
you there. If anything doesn't work, let the w
Hi there,
I am fairly new to python, the problem is as follows:
newnodes = {}
for i in nodes:
newnodes[i.label] = i.coordinate
is very slow, which is due to the dots, I know that for functions the
dot lookup
can be done outside the loop, can this be done for attributes in any
way? (in such
Hi
rh0dium wrote:
> I am relatively new to python and certainly new to XML parsing.
Me too. However there are plenty of good docs/tutorials available to
help with both XML and using it in Python.
For XML you may wish to look at http://www.w3schools.com/. It has a very
accessible set
"rh0dium" wrote:
> I am relatively new to python and certainly new to XML parsing. Can
> some show me how to get the product text out of this?
didn't you ask the same question a few days ago? did you read the
replies to that post?
assuming that your sample is correct, you need to process the a
Fredrik Lundh wrote:
> didn't you ask the same question a few days ago? did you read the
> replies to that post?
Yes I did but the XML was malformed.. Actually it still is but you
helped me figure out a way to correct it - Thanks
Here is what I have so far. Now I want to find a child of a chi
"rh0dium" wrote:
> Ok so up to here I am ok. I find ( If you want the full xml let me
> know) two blocks of system memory. It MUST be "System Memory" only.
> Now how do I get a list of all of the children "nodes" of this. They
> are named bank:N ( i.e bank:0, bank:1 etc [see below] ). For eac
On May 29, 2005, at 12:39 AM, cheng wrote:
> hi all
> a string like
>
> "(word1 & (Word2|woRd3))"
>
> how can i use the re to split it to
>
> ['word1', 'word2', 'word3']
Could you be more exact about what the string is like? Does it
literally contain the characters '&' and '|' ? If so, just
im sorry, my engilsh is not vell well,
the string not only contain '&' and '|' and it can be anyting
i just want to split out the "whole word" inside the string
--
http://mail.python.org/mailman/listinfo/python-list
i try
query = query.lower()
print re.split(r'\W+',theString)
the reslut is :
['', 'word1', 'word2', 'word3', '']
how can i fix the statment to get
['word1', 'word2', 'word3']
--
http://mail.python.org/mailman/listinfo/python-list
i try
theString= theString.lower()
print re.split(r'\W+',theString)
the reslut is :
['', 'word1', 'word2', 'word3', '']
how can i fix the statment to get
['word1', 'word2', 'word3']
--
http://mail.python.org/mailman/listinfo/python-list
On May 29, 2005, at 12:57 AM, cheng wrote:
> im sorry, my engilsh is not vell well,
>
> the string not only contain '&' and '|' and it can be anyting
>
> i just want to split out the "whole word" inside the string
If the string could be anything, how do you know where the words are?
If it's whi
cheng wrote:
> im sorry, my engilsh is not vell well,
That's alright, you could have been french. ;)
> the string not only contain '&' and '|' and it can be anyting
>
> i just want to split out the "whole word" inside the string
Look at the example for split function of re module in the doc [1]
On Sun, 29 May 2005 at 07:39 GMT, cheng wrote:
> hi all
> a string like
>
> "(word1 & (Word2|woRd3))"
>
> how can i use the re to split it to
>
> ['word1', 'word2', 'word3']
This splits the string on one or more occurrences of any character
that is not alphanumeric:
import re
str = "(
thx for help..i got it now :)
--
http://mail.python.org/mailman/listinfo/python-list
"cheng" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
| hi all
| a string like
|
| "(word1 & (Word2|woRd3))"
|
| how can i use the re to split it to
|
| ['word1', 'word2', 'word3']
|
import re
s = "(word1 & (Word2|woRd3)"
parts = re.split('\W+', s)
print [p for p in parts if
901 - 1000 of 2600 matches
Mail list logo