> a lot of times I need to replace more than one char into a
> string, so I have to do something like
>
> value = "test"
> chars = "e"
> for c in chars:
>value = value.replace(c, "")
>
> A solution could be that "replace" accept a tuple/list of
> chars, like that was add into the new 2.5 for
d early 1970s. GUIs, color, 3D, structured progamming,
networking, interpreters, Unix; the list goes on and on. It was probably
the most exciting time in the history of computers.
--
- Tim Roberts, [EMAIL PROTECTED]
Providenza & Boekelheide, Inc.
--
http://mail.python.org/mailman/listinfo/python-list
[bruce]
> perl has the concept of "die". does python have anything similar. how can a
> python app be stopped?
>
> the docs refer to a sys.stop.
Python docs? Doubt it ;-)
> but i can't find anything else... am i missing something...
>>> import sys
>>> print sys.exit.__doc__
exit([status])
Exit
> /* $Id: dotquad.c 3529 2005-10-01 10:15:22Z dyoung $ */
Well, let's begin here. You've got your python commenting style
all wrong. This alone won't parse as python. I recommend using
the standard "#" comment notation as described in the python docs.
> if (argc != 2 || !inet_aton(argv
>> , Access can retrieves a not empty recordset but my python code
>> retrieves a empty recordset.
>
> Which is exactly what it _should_ return on that query, unless you have
> records with "e*" in column field1.
>
> The proper SQL clause is:
>
> ... WHERE field1 LIKE 'e*' ...
which would
rpose. Some people include one for completeness -- a coding standard
that "all paths must have a return statement", for instance.
--
- Tim Roberts, [EMAIL PROTECTED]
Providenza & Boekelheide, Inc.
--
http://mail.python.org/mailman/listinfo/python-list
[Nathan Bates]
> Are the Python developers running Python under Valgrind?
Please read Misc/README.valgrind (in your Python distribution).
--
http://mail.python.org/mailman/listinfo/python-list
Dale King <[EMAIL PROTECTED]> wrote:
>Tim Roberts wrote:
>> "Xah Lee" <[EMAIL PROTECTED]> wrote:
>>
>>> Languages with Full Unicode Support
>>>
>>> As far as i know, Java and JavaScript are languages with full, complete
>>&g
about better ways to do this, but I'd
like to point out that this one line is equivalent to:
print c.a.a()
--
- Tim Roberts, [EMAIL PROTECTED]
Providenza & Boekelheide, Inc.
--
http://mail.python.org/mailman/listinfo/python-list
> sstr = sesslist[0] << these should be the same
> trstr = trlist[3]<< "Summer A"
>
> sstr.strip(sstr)
> trstr.strip(trstr)
>
> print "slen = ",len(sstr)
> print "trlen = ",len(trstr)
Have you tried printing the repr(sstr) and repr(trstr) to see
cipy.
HTH
Tim
On 7/7/06, Ray Tomes <[EMAIL PROTECTED]> wrote:
> Hi Folks
>
> I am an old codger who has much experience with computers
> in the distant past before all this object oriented stuff.
> Also I have loads of software in such languages as FORTRAN
> and BASIC, QBA
On 07/07/06, Jack <[EMAIL PROTECTED]> wrote:
> I just did some testing between CherryPy's web server and lighttpd.
> My test was very simple and I used ab.exe for this purpose.
> CherryPy web server can serve about 140 simple request / second, while
> lighttpd can handle around 400 concurrent reque
On 7 Jul 2006 06:27:43 -0700, Gerard Flanagan <[EMAIL PROTECTED]> wrote:
>
> Tim Williams wrote:
> > On 07/07/06, Jack <[EMAIL PROTECTED]> wrote:
> > > I just did some testing between CherryPy's web server and lighttpd.
> > > My test was
> Just forget the lists...
>
> counters = {0:0, 1:0, 2:0, 3:0, 4:0}
You'll notice that the OP's code had multiple references to the
same counter (0, 1, and 3 all mapped to type1)
The OP's method was about as good as it gets. One might try to
redo it with an accumulator class of some sort:
cl
Claudio Grondi wrote:
> I am aware, that it is maybe the wrong group to ask this question, but
> as I would like to know the history of past file operations from within
> a Python script I see a chance, that someone in this group was into it
> already and is so kind to share here his experience.
Claudio Grondi wrote:
> Here a small update to the code at
> http://timgolden.me.uk/python/win32_how_do_i/watch_directory_for_changes.html#use_readdirectorychanges
> :
>
> ACTIONS = {
>1 : "Created",
>2 : "Deleted",
>3 : "Updated",
>4 : "Renamed from something"
>5 : "Renamed to
[Tim Golden]
>> On the offchance that you haven't seen it, you might
>> look at this:
>>
>> http://timgolden.me.uk/python/win32_how_do_i/watch_directory_for_changes.html#use_readdirectorychanges
>>
[Claudio Grondi]
> It seems, that it will be necessary to u
> 1. How can i disable some of the modules without deleting. e.g I wish
> to disable "os" module.
If you're prepared for the massive breakage that will ensue, you can
chmod go-rwx /usr/lib/python2.3/os.*
(assuming *nix as you later detail).
> 2. How can i force user code to access only
pecial characters in there that make the program say something I can't
immediately discern.
To be sure, people whose opinions I trust (one of whom is Cliff Wells) have
said that Ruby is great, so I suppose I need to look again. I just haven't
had the same "aha!" experience tha
gets added to the SmTP
This is how a Bcc: is done. A Bcc: header is never included in an e-mail
message. The address gets included in the envelope, but not in the headers
or body.
--
- Tim Roberts, [EMAIL PROTECTED]
Providenza & Boekelheide, Inc.
--
http://mail.python.org/mailman/listinfo/python-list
Tim wrote:
> I ran into a problem with a script i was playing with to check code
> indents and need some direction. It seems to depend on if tabsize is
> set to 4 in editor and spaces and tabs indents are mixed on consecutive
> lines. Works fine when editors tabsize was 8 r
>> Just because something is slow or sub-optimal doesn't mean it
>> should be an error.
>
> that's not an error because it would be "slow or sub-optimal" to add
> custom objects, that's an error because you don't understand how "sum"
> works.
>
> (hint: sum != reduce)
No, clearly sum!=reduce.
> I am a member of another list that has at least one member
> who has lost his vision, and reads his news with a speech
> generator. It is terribly inconvenient for him to follow
> a thread full of 'bottom postings', as he is then forced to
> sit through the previous message contents again and ag
[Chandrashekhar kaushik]
> Can an object pickled and saved on a little-endian machine be unpickled
> on a big-endian machine ?
Yes. The pickle format is platform-independent (native endianness
doesn't matter, and neither do the native sizes of C's various integer
types).
> Does python handle thi
[Claudio Grondi]
> I have a 250 Gbyte file (occupies the whole hard drive space)
Then where is Python stored ;-)?
> and want to change only eight bytes in this file at a given offset of appr.
> 200
> Gbyte (all other data in that file should remain unchanged).
>
> How can I do that in Python?
S
a floating point value which was "less than" the
>> value returned by the previous invokation. The computer was a pretty fast
>> one (P4 3Ghz I think, running Windows XP), and this happened only between
>> very close invokations of time.clock().
[Terry Reed]
> I se
>> Also, what made the expression greedy?
>
> They usually are, by default. It means that when there
> are more than one ways to match the pattern, choose the
> one that matches the most text. Often there are flags
> available to change that behavior. I'm not sure off hand
> how to do it with t
> Is there a ready to use (free, best Open Source) tool able to sort lines
> (each line appr. 20 bytes long) of a XXX GByte large text file (i.e. in
> place) taking full advantage of available memory to speed up the process
> as much as possible?
Sounds like an occasion to use a merge-sort. Th
> ##
> import re
>
> s = 'xxx0'
>
> m = re.search("x*", s)
> print "First way", m.group(0)
>
> m = re.search("x*?", s)
> print "Second way", m.group(0)
> #
> First way xxx
> Second way
>
> So now I'm really confused
> At this time right now I prefer to do something that works the quickest
> possible...
> I never had any experience with CGI, do I need to set up a web server
> for that ?
> can you point me some usefull reading material so I can get a start ?
> I will post for a comment at Zope , I had installed
x27;
dbs = []
for i in range(2): dbs.append(fLocked(fname))
print dbs[0].aquire_lock()
print dbs[1].aquire_lock(1) #should fail getting flock
dbs[0].release_lock()
print dbs[1].aquire_lock() #should be able to get lock
--Tim
--
http://mail.python.org/mailman/listinfo/python-list
"Tim Peters" <[EMAIL PROTECTED]> wrote:
>[Giovanni Bajo[
>>> I experimented something very strange, a few days ago. I was debugging an
>>> application at a customer's site, and the problem turned out to be that
>>> time.clock() was going &quo
[Claudio Grondi]
> Here an example of what I mean
> (Python 2.4.2, IDLE 1.1.2, Windows XP SP2, NTFS file system, 80 GByte
> large file):
>
> >>> f = file('veryBigFile.dat','r')
> >>> f = file('veryBigFile.dat','r+')
>
> Traceback (most recent call last):
>File "", line 1, in -toplevel-
>
> obj1 = c1(1)
>
> obj1 + 10 # this works just fine
>
10 + obj1 # throws exception
> Q. What do I have to do to make the following line work?
>
> 10 + obj1
http://docs.python.org/ref/numeric-types.html
You want to read the section on __radd__ (and it's o
[EMAIL PROTECTED]
>> The documentation for PyThreadState_SetAsyncExc says "To prevent naive
>> misuse, you must write your own C extension to call this". Anyone care
>> to list a few examples of such naive misuse?
[and again]
> No? I'll take that then as proof that it's impossible to misuse the
>
> I want to search the file until I find '/FontName /ACaslonPro-Semibold'
> and then jump forward 7 lines where I expect to find '/FSType 8'. I
> then want to continue searching from *that* point forward for the next
> FontName/FSType pair. Unfortunately, I haven't been able to figure out
> how t
> The other thing I failed to mention is that I need to ensure that I
> find the fsType *before* I find the next FontName.
found_fontname = False
font_search = '/FontName /ACaslonPro-Semibold'
type_search = '/FSType 8'
for line in file('foo.txt'):
if font_search in line:
if
Norman Khine wrote:
> Hello,
> I have a csv file which is has a field that has something like:
>
> text.csv
> "text (xxx)"
> "text (text) (yyy)"
> "text (text) (text) (zzz)"
>
> I would like to split the last '(text)' out and put it in a new column,
> so that I get:
>
> new_test.csv
> "text","
[Joachim Durchholz]
>>> Wikipedia says it's going from 2NlogN to N. If a sort is massively
>>> dominated by the comparison, that could give a speedup of up to 100%
>>> (approximately - dropping the logN factor is almost irrelevant, what
>>> counts is losing that factor of 2).
[Gabriel Genellina]
>
7;re interested in.
>>>
>>> If it's asymptotic behavior, then the O(logN) factor is a difference.
>>>
>>> If it's practical speed, a constant factor of 2 is far more relevant
>>> than any O(logN) factor.
[Tim Peters]
>> Nope. Even if you
in. Did you get this from a web
page? Can you tell me where?
--
- Tim Roberts, [EMAIL PROTECTED]
Providenza & Boekelheide, Inc.
--
http://mail.python.org/mailman/listinfo/python-list
if it's using a standard XP interface (like DirectShow or
WIA), there's a good chance it will drive your 1394 camera as well.
--
- Tim Roberts, [EMAIL PROTECTED]
Providenza & Boekelheide, Inc.
--
http://mail.python.org/mailman/listinfo/python-list
s not. A multipart/alternative section is constructed exactly the
same as any other multipart section. It just so happens that it will have
exactly two subsections, one text/plain and one text/html.
--
- Tim Roberts, [EMAIL PROTECTED]
Providenza & Boekelheide, Inc.
--
http://mail.python.org/mailman/listinfo/python-list
[/T]
>> OTOH, current versions of Python (and Perl)
[/F]
> just curious, but all this use of (& Perl) mean that the Perl folks have
> implemented timsort ?
A remarkable case of independent harmonic convergence:
http://mail.python.org/pipermail/python-dev/2002-July/026946.html
Come to think
[John Salerno]
| Interesting question. Just as a curious follow-up (not being
| someone who works in the programming world), why does it take
| so long to move to the latest version, especially when there
| aren't (I don't think) any changes that would break existing
| code, such as moving to
On 29 Aug 2006 20:43:49 -0700, alex23 <[EMAIL PROTECTED]> wrote:
> abcd wrote:
> > ok, no of any python solutions? or command-line firewalls?
>
> You did try searching Google for "python firewall", right?
>
> http://www.google.com.au/search?q=python+firewall
>
> The very first entry is a pointer t
> Not page/swap -- by default Windows only gives 2GB to
> applications for data; the rest is held for shared OS kernel
> usage.
Is it just me or does this seem ludicrous? If I had a bunch of
re$ource$ and I employed someone to manage them for me, would I
find it acceptable that they consume hal
[Aahz]
>> Assuming you're talking about CPython, strings don't really participate
>> in garbage collection. Keep in mind that the primary mechanism for
>> reaping memory is reference counting, and generally as soon as the
>> refcount for an object goes to zero, it gets deleted from memory.
[Les S
[Dermot Doran]
| I'm very new to using win32com! I just want to send an email
| message via Outlook. However, I keep getting an annoying
| message box (generated by Outlook) indicating that my program
| could be a virus. Does anybody know how to get around this?
As far as I've ever been a
[Dermot Doran]
| looks like I might be back to the drawing board :-( Thanks
| for letting me know what your experiences have been.
Just to elaborate slightly on that experience, if all I want
to do is to send an email (ie not look up addresses on Contacts
or do any fancy Outlook-related thing)
> I need a program that simultaneously can copy a single file (1
> GB) from my pc to multiple USB-harddrives.
Sounds like a pretty simple simple python script:
---
#!/bin/env python
def spew(source_file_name,
output_file_names,
> metaperl> I am hoping for something that can create database deltas.
>
> What is a database delta? I know about SELECT, CREATE, INSERT, UPDATE,
> joins, normalization, etc, but have never heard this term before.
There are two types of database deltas that I know of: metadata
deltas (ch
On 1 Sep 2006 03:26:12 -0700, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
> How do I add a Sender name to the emails sent by the following script:
>
>
> writer = MimeWriter.MimeWriter(out)
> # set up some basic headers... we put subject here
> # because smtplib.sendmail ex
On 01/09/06, Tim Williams <[EMAIL PROTECTED]> wrote:
> On 1 Sep 2006 03:26:12 -0700, [EMAIL PROTECTED]
> <[EMAIL PROTECTED]> wrote:
> > How do I add a Sender name to the emails sent by the following script:
> >
> add the line
>
> writer.addheader("From
> I have this string on a field
> CN=pointhairedpeoplethatsux,OU=Groups,OU=Hatepeople,OU=HR,DC=fabrika,DC=com;CN=pointhairedboss,OU=Groups,OU=Hatepeople,OU=HR,DC=fabrika,DC=com
> this string is all the groups one user has membership.
> So what I am trying to do.
> read this string
> and extract onl
>> I have this string on a field
>> CN=pointhairedpeoplethatsux,OU=Groups,OU=Hatepeople,OU=HR,DC=fabrika,DC=com;CN=pointhairedboss,OU=Groups,OU=Hatepeople,OU=HR,DC=fabrika,DC=com
>> this string is all the groups one user has membership.
>> So what I am trying to do.
>> read this string
>> and extra
jwaixs wrote:
> Hello,
>
> How can I disgrate (probably not a good word for it) a list? For
> example:
>
> a = [1,2]
> b = 3
> c = [a] + [b] # which makes [[1,2],3]
>
> Then how can I change c ([[1,2],3]) into [1,2,3]? I have a simple
> function for this:
>
> def fla
> Suppose we have a very large file, and wanna remove 'n' bytes in the
> middle of the file. My thought is:
> 1, read() until we reach the bytes should be removed, and mark the
> position as 'pos'.
> 2, seek(tell() + n) bytes
> 3, read() until we reach the end of the file, into a variable, say 'a'
> def shift(f, offset, size, buffer_size=1024*1024):
Slight bug in that function implementation. This one passes my
tests.
Sorry about that.
-tkc
def shift(f, offset, size, buffer_size=1024*1024):
"""deletes (in place) a portion of size "size" from file "f",
starting at offset "offs
[EMAIL PROTECTED] wrote:
>AlbaClause wrote:
>
>> for i in range(length):
>> print i
>
>Or usually better:
>
>for ii in xrange(length):
>...
xrange used to be better. As I understand it, that's no longer the case.
--
- Tim Roberts, [EMAIL PROT
>> feed_list = open("feed_listing.conf","r")
>
> What could it be about the above line that means "Open this file for
> READ ONLY"?
Oooh, oooh, I know! If you rot13 the file-name, it comes back as
"srrq_yvfgvat.pbas". The double "r"s in the file-name instruct
python to open the file as "reall
> When I create an instance of a class,
> are the class's functions *copied* to create the methods?
> Or are method calls actually calls of the class's functions?
>
> I am sure this is both obvious and FAQ,
> but I did not find a clear answer
The best way to find out is to try it:
##
On 04/09/06, Dr. Pastor <[EMAIL PROTECTED]> wrote:
> In the following code I would like to ascertain
> that x has/is a number. What the simplest TEST should be?
> (Could not find good example yet.)
> ---
> x=raw_input('\nType a number from 1 to 20')
> if TEST :
> Do_A
> else:
>
> t = (1, (2, 3))
>
> I am bit suprised, that I cannot access '3' via:
> t[1].[1] # syntax error
>
> But t[1].__getitem__(1) works like expected.
>
> Why is that?
What is "t"? It's a tuple. A tuple can be indexed, or you can
call its __getitem__ method. Thus, the one-th element of t is eith
python2.4/site-packages to
> /usr/local/lib/python2.5 ?
I've started keeping the tarballs for all of the packages I install in a
single directory, along with a shell script to install each of them. It
makes upgrading much easier. I do this on both Linux and Windows.
--
- Tim Robe
> And receiving hotmail (or any outher webmail) using scraping
> techniques is a daunting task, to say the least - you should
> forget about that IMHO.
There's a perl project called "gotmail" that will do the scraping
to dump in a local mailbox file (I don't remember whether it's MH
or mbox form
On 05/09/06, Gregory Piñero <[EMAIL PROTECTED]> wrote:> I'm going
to assume that it's supposed to work like this, but could
> someone tell me the reasoning behind it? I.E. why is 3 skipped?
>
> >>> alist=[1,2,3]
> >>> for item in alist:
> print item
> if item==2:
>
On 05/09/06, Tim Williams <[EMAIL PROTECTED]> wrote:
> On 05/09/06, Gregory Piñero <[EMAIL PROTECTED]> wrote:> I'm going
> to assume that it's supposed to work like this, but could
> > someone tell me the reasoning behind it? I.E. why is 3 skipped?
> >
On 05/09/06, Gregory Piñero <[EMAIL PROTECTED]> wrote:
> On 9/5/06, Tim Williams <[EMAIL PROTECTED]> wrote:
> > > It does already, you just haven't grasped list fully yet :):)
> > >
> > > when you remove 2 from alist, the list becomes length 2, the
L.remove(value) -- remove first occurrence of value
you were possibly thinking of alist.pop(2), which removes the item
alist[2] from alist
HTH :)
--
Tim Williams
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED]
| I'm a dba for SQL server and I Will import a textfile to SQL.
Not a Python answer, but unless you're in it for the
learning experience, I *seriously* suggest you look
at the built-in BULK INSERT command to see if it
meets your needs.
Random URL:
http://www.sqlteam.com/item.
[Kai Mayfarth]
| Ist there a way to search a Adressbook over Python for a
| special contact.
| I know how i read and write a contact, but know i have to search over
| Python for some contacts, because the adress book has know over 1700
| entrys, and it tooks a long time to get them all over the
| [Kai Mayfarth]
|
| | Ist there a way to search a Adressbook over Python for a
| | special contact.
[TJG]
| As far as I can see from a quick glance, there is no method
| of the AddressList or AddressEntries objects which calls into
| the Outlook code itself to search
Although now I Google a li
(reader)
print data
#
# Something like:
# [[1, "Tim", "Golden"], [2, "Fred", "Smith"], ...]
#
OK, now you've got a list of lists, each entry being one
row in your original file, each item one column. To get
it into your database, you'll need s
[EMAIL PROTECTED]
| Traceback (most recent call last):
| File "txttosql6.py", line 23, in ?
| row
| File "C:\Python24\Lib\site-packages\pymssql.py", line 120, in execute
| self.executemany(operation, (params,))
| File "C:\Python24\Lib\site-packages\pymssql.py", line 146, in
| executemany
|
[Rama]
| I want to list the names of all the processes running on
| my machine. I am stuck at this point and do not know how to
| extract the name of a process.
WMI is good for this kind of thing:
http://tgolden.sc.sabren.com/python/wmi_cookbook.html#running_processes
TJG
__
[EMAIL PROTECTED]
| i gott the same results with both executemany and execute. i will try
| with some other sql modules. if you try tim so let me now if
| you cot it
| to work.
OK, the relevant thing here is the paramstyle. When I made that
misguided claim earlier that "?" was the m
ument PostgreSQL, MySQL, Oracle, Apache, Posix, Win32 etc ?
Warning: misplaced sarcasm detected
--
- Tim Roberts, [EMAIL PROTECTED]
Providenza & Boekelheide, Inc.
--
http://mail.python.org/mailman/listinfo/python-list
On 07/09/06, Sybren Stuvel <[EMAIL PROTECTED]> wrote:
> sridhar enlightened us with:
> > iam having user account on an exchangeserver.
> > with that can i send an email using python?
> >
> > if iam using the following code iam getting error
> >
> > Traceback (most recent call last):
> > File
> >
[Phoe6]
| I have to uninstall an application and I don't find the uninstaller,
| the option available to me is to access Add/Remove Programs,
| select the
| application and remove from there.
|
| I am trying to automate this task using Python:
| 1) Get the Application Name
| 2) Access the Add/R
On 07/09/06, Sybren Stuvel <[EMAIL PROTECTED]> wrote:
> Tim Williams enlightened us with:
> > Can you send email via it using outlook express or a similar
> > POP3/IMAP mail client?
>
> Wouldn't you use a SMTP client to send email?
Outlook Express *is* a mail clien
On 07/09/06, Hari Sekhon <[EMAIL PROTECTED]> wrote:
>
> Grant Edwards wrote:
> On 2006-09-07, Sybren Stuvel
> <[EMAIL PROTECTED]> wrote:
>
>
> Tim Williams enlightened us with:
>
>
> Can you send email via it using outlook express or a similar
> P
| Is it possible to get the mac address of a device
| with python 2.4 using code which works in wxp and linux
| rather than requiring some code for windows and some
| other code for linux ?
I'm fairly sure the answer's no. It wouldn't be beyond
the wit of man to produce a library with conditiona
defcon8 wrote:
> How can I print html documents in Python on Windows?
Hopefully this technique will work:
http://timgolden.me.uk/python/win32_how_do_i/print.html#shellexecute
TJG
--
http://mail.python.org/mailman/listinfo/python-list
On 7 Sep 2006 14:30:25 -0700, Adam Jones <[EMAIL PROTECTED]> wrote:
>
> Francach wrote:
> > Hi,
> >
> > I'm trying to use the Beautiful Soup package to parse through the
> > "bookmarks.html" file which Firefox exports all your bookmarks into.
> > I've been struggling with the documentation trying t
On 07/09/06, Anthra Norell <[EMAIL PROTECTED]> wrote:
> s = '''
> $14.99
> ,
> $27.99
> ,
> $66.99
> ,
> $129.99
> ,
> $254.99
>'''
>
> >>> for line in [l.strip () for l in s.splitlines ()]:
> if line [0] == '$': print line
>
> $14.99
> $27
On 08/09/06, Tim Williams <[EMAIL PROTECTED]> wrote:
> >>> print '\n'.join([i for i in s.splitlines() if i[0] == '$'])
> $14.99
> $27.99
> $66.99
> $129.99
> $254.99
>
or even more terse,
>>> print '\n'.join([i for
Phoe6 wrote:
> Tim Golden wrote:
> > [Phoe6]
> > and perhaps you need something like
> > this (altho' obviously more sophisticated):
> >
> > import wmi
> >
> > appname = "Python 2.4.3"
> > c = wmi.WMI ()
> > for p
Tor Erik wrote:
> Hi,
>
> This should be possible as Taskmanager tracks CPU usage for every
> process... Anyone know how this can be done?
>
WMI can probably do the trick. If you can find something on Google
for wmi cpu usage (or something similar) then translation to Python's
usually quite easy.
> Let's say, for instance, that one was programming a spell checker or
> some other function where the contents of a string from a text-editor's
> text box needed to be split so that the resulting array has each word
> as an element. Is there a shortcut to do this and, if not, what's the
> best an
> py> import re
> py> rgx = re.compile(r'(?:\s+)|[()\[\].,?;-]+')
> py> [s for s in rgx.split(astr) if s]
> ['Four', 'score', 'and', 'seven', 'years', 'ago', 'our', 'forefathers',
> 'who', 'art', 'in', 'heaven', 'hallowed', 'be', 'their', 'names', 'did',
> 'forthwith', 'declare', 'that', 'all', '
>> rgx = re.compile('\W+')
>>
>> if you don't mind numbers included you text (in the event you
>> have things like "fatal1ty", "thing2", or "pdf2txt") which is
>> often the case...they should be considered part of the word.
>>
>> If that's a problem, you should be able to use
>>
>> rgx =
ters. That is only available with C++, so I'm
afraid you are out of luck. You may be able to use SWIG to generate an
interface for this; I've had good luck with SWIG.
--
- Tim Roberts, [EMAIL PROTECTED]
Providenza & Boekelheide, Inc.
--
http://mail.python.org/mailman/listinfo/python-list
-Win32 includes an
interface for that (import win32pdh), but I've never used it.
--
- Tim Roberts, [EMAIL PROTECTED]
Providenza & Boekelheide, Inc.
--
http://mail.python.org/mailman/listinfo/python-list
>> Any more crazy examples? :)
>
> 'ey, 'alf a mo, wot about when 'enry 'n' 'orace drop their aitches?
I said "crazy"...not "pathological" :)
If one really wants such a case, one has to omit the standard
practice of nesting quotes:
John replied "Dad told me 'you can't go' but let Judy"
> I have a file with several entries in the form:
>
> AFFX-BioB-5_at E. coli /GEN=bioB /gb:J04423.1 NOTE=SIF
> corresponding to nucleotides 2032-2305 of /gb:J04423.1 DEF=E.coli
> 7,8-diamino-pelargonic acid (bioA), biotin synthetase (bioB),
> 7-keto-8-amino-pelargonic acid synthetase (
On 11 Sep 2006 05:29:17 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have a file with several entries in the form:
>
> AFFX-BioB-5_at E. coli /GEN=bioB /gb:J04423.1 NOTE=SIF
> corresponding to nucleotides 2032-2305 of /gb:J04423.1 DEF=E.coli
> 7,8-diamino-pelargonic acid (b
[Rob Wolfe]
| Hari Sekhon wrote:
| > I am writing a wrapper to a binary command to run it and then do
| > something with the xml output from it.
| >
| > What is the best way of making sure that the command is
| installed on the
| > system before I try to execute it, like the python equivalent of t
On 11/09/06, Hari Sekhon <[EMAIL PROTECTED]> wrote:
>
> Steve Holden wrote:
> Hari Sekhon wrote:
>
>
> The easiest way to test whether the command will run is to try and run
> it. If the program doesn't exist then you'll get an exception, which you
> can catch. Otherwise you'll be stuck with non
> Erm, but don't you *have* to run the program anyway to produce
> the required XML output? So, if the attempt to run it fails
> then you know it isn't installed, and if it succeeds then you
> should have the required output (I'm presuming either the
> output will appear in a file or you'll be usin
3401 - 3500 of 7549 matches
Mail list logo