Hey guys,
So I have a question regarding the split() function in the string
module. Let's say I have an string...
input = "2b 3 4bx 5b 2c 4a 5a 6"
projectOptions = (input.replace(" ", "")).split('2')
print projectOptions
['', 'b34bx5b', 'c4a5a6']
My question is, why is the first element of proj
cjl wrote:
> P:
>
> I am screen-scraping a table. The table has an unknown number of rows,
> but each row has exactly 8 cells. I would like to extract the data
> from the cells, but the first three cells in each row have their data
> nested inside other tags.
>
> So I have the following code:
>
On 2007-04-20, kevinliu23 <[EMAIL PROTECTED]> wrote:
> Hey guys,
>
> So I have a question regarding the split() function in the string
> module. Let's say I have an string...
>
> input = "2b 3 4bx 5b 2c 4a 5a 6"
> projectOptions = (input.replace(" ", "")).split('2')
> print projectOptions
>
> ['',
P:
I am screen-scraping a table. The table has an unknown number of rows,
but each row has exactly 8 cells. I would like to extract the data
from the cells, but the first three cells in each row have their data
nested inside other tags.
So I have the following code:
for row in table.findAll("tr
Colin J. Williams wrote:
> I'm not sure that scipy has been updated to Python 2.5
? scipy certainly works with 2.5. Are you referring to something else perhaps?
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad att
kevinliu23 wrote:
> Hey guys,
>
> So I have a question regarding the split() function in the string
> module. Let's say I have an string...
>
First of all, the string module is pretty much deprecated nowadays. What
you are actually using, the .split() method of a string, is the
preferred way to
On Apr 20, 1:51 pm, kevinliu23 <[EMAIL PROTECTED]> wrote:
> Hey guys,
>
> So I have a question regarding the split() function in the string
> module. Let's say I have an string...
>
> input = "2b 3 4bx 5b 2c 4a 5a 6"
> projectOptions = (input.replace(" ", "")).split('2')
> print projectOptions
>
>
On Apr 20, 2:05 pm, Steve Holden <[EMAIL PROTECTED]> wrote:
>
> did you try something like (untested)
>
> cell1, cell2, cell3, cell4, cell5, \
> cell6, cell7, cell8 = row.findAll("td")
>
> No need for the "for" if you want to handle each cell differently, you
> won;t be iterating o
Steve Holden wrote:
> Marc 'BlackJack' Rintsch wrote:
>
>> In <[EMAIL PROTECTED]>, John Nagle wrote:
>>
>>> Many cases are easy. If a smart compiler sees
>>>
>>> for i in range(n) :
>>>... # something
>>>
>>> and there are no other assignments to "i", then it's clear that
>>> "i"
En Fri, 20 Apr 2007 11:40:00 -0300, Alex Martelli <[EMAIL PROTECTED]> escribió:
> I'm still interested to know where that erroneous quote from Alan Isaac
> comes from, because if it's in Python's docs, it can be fixed.
It was a partial quote, that's why it appeared to be wrong:
Library reference
I have some HTML such as
blah blah blah
I wnat to pull out the text that lies inside the quotes of the src
attribute. So in this example I would get image/blah/a.jpg
My regex so far is: src=\"(.*)\" however the group in this case
would end up being, image/blah/a.jpg" id="d">bla
kevinliu23 wrote:
> Hey guys,
>
> So I have a question regarding the split() function in the string
> module. Let's say I have an string...
>
> input = "2b 3 4bx 5b 2c 4a 5a 6"
> projectOptions = (input.replace(" ", "")).split('2')
> print projectOptions
>
> ['', 'b34bx5b', 'c4a5a6']
>
> My que
abcd wrote:
> My regex so far is: src=\"(.*)\" however the group in this case
> would end up being, image/blah/a.jpg" id="d">blah blah blah a>.
>
> how can I tell the regex group (.*) to end when it gets to the first
> " ?
Use non-greedy matching, i.e. src=\"(.*?)\" (question mark af
thanks, forgot that.
--
http://mail.python.org/mailman/listinfo/python-list
On Apr 20, 2007, at 2:44 PM, Robert Kern wrote:
> Colin J. Williams wrote:
>
>> I'm not sure that scipy has been updated to Python 2.5
>
> ? scipy certainly works with 2.5. Are you referring to something
> else perhaps?
A side question: Is there any plans of updating the scipy.org
Superpack bu
Iou need only consider having cartesian coordinate sets as the keys
for an example. A 2 dimensional list might be overly expensive if your
coordinates span a large area but are relatively sparse.
--
http://mail.python.org/mailman/listinfo/python-list
Tommy Grav wrote:
> On Apr 20, 2007, at 2:44 PM, Robert Kern wrote:
>> Colin J. Williams wrote:
>>
>>> I'm not sure that scipy has been updated to Python 2.5
>> ? scipy certainly works with 2.5. Are you referring to something
>> else perhaps?
>
> A side question: Is there any plans of updating t
> > How can I determine what tab is currently selected in a Tile.Notebook
> > widget?
>
> > The best suggestion I've been able to find via Google is
> > "mynotebook.index('current')", but that gets an exception from Tcl.
>
> How about
>
> mynotebook.index.current()
No good: AttributeError: 'funct
Hi,
When I call urlopen.read() like this:
data = urlopen("http://localhost";).read().
Does that mean I will read the whole document to data, regardless how
many data being sent back?
Thank you.
--
http://mail.python.org/mailman/listinfo/python-list
On Apr 20, 2007, at 3:15 PM, [EMAIL PROTECTED] wrote:
> On Apr 20, 1:51 pm, kevinliu23 <[EMAIL PROTECTED]> wrote:
>> ['', 'b34bx5b', 'c4a5a6']
>>
>> My question is, why is the first element of projectOptions an empty
>> string? What can I do so that the first element is not an empty
>> string? but
--- Andrew Veitch <[EMAIL PROTECTED]> wrote:
> In Perl I would just use Crypt:RSA which has a sign
> method with an armour option which generates exactly
> what I want but I can't find a way of doing this in
> Python.
I've worked it out, just for the archives the answer
is:
import base64
from M2
On Apr 20, 2007, at 3:49 PM, Robert Kern wrote:
> Tommy Grav wrote:
>> On Apr 20, 2007, at 2:44 PM, Robert Kern wrote:
>>> Colin J. Williams wrote:
>>>
I'm not sure that scipy has been updated to Python 2.5
>>> ? scipy certainly works with 2.5. Are you referring to something
>>> else perhaps?
hi,
i am designing a desktop search engine using python.
i am having a query , is there a package available that contains
functions for retrieving the files being edited , created,deleted in
the file system.
thanks
--
http://mail.python.org/mailman/listinfo/python-list
QOTW: "I can't say enough about Python and agile programming. Piecing
together small, well-documented, well-tested pieces of software makes
solving big problems easier." - Shannon Behrens of Foxmarks; May DDJ
http://www.ddj.com/dept/architect/198800578
"Automatic type inference may be su
ken wrote:
> Hi,
>
> When I call urlopen.read() like this:
>
> data = urlopen("http://localhost";).read().
>
> Does that mean I will read the whole document to data, regardless how
> many data being sent back?
>
> Thank you.
>
Yes. However you can read (and presumably process)one line at a tim
En Thu, 19 Apr 2007 17:33:19 -0300, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> escribió:
> On Apr 19, 6:54 am, Antoon Pardon <[EMAIL PROTECTED]> wrote:
>> I don't know how you come to the conclusion that it is a mathematical
>> absurdity but consider this: If you find that common usage propagates
>>
Tommy Grav wrote:
> On Apr 20, 2007, at 3:15 PM, [EMAIL PROTECTED] wrote:
>> On Apr 20, 1:51 pm, kevinliu23 <[EMAIL PROTECTED]> wrote:
>>> ['', 'b34bx5b', 'c4a5a6']
>>>
>>> My question is, why is the first element of projectOptions an empty
>>> string? What can I do so that the first element is not
Hi, I am learning Numpy and using it for a course project.
Suppose x = [0, 1, 2, 3, 4], I know that x[0:2] would give [0,1], and
x[-1] give [4], is there a way that I can get [4,0,1]. I try x[-1:2],
but it returns an empty array.
I am doing convolution (e.g. convolve [0, 1, 2, 3, 4] with [1,-2,1])
En Fri, 20 Apr 2007 17:06:51 -0300, rohit <[EMAIL PROTECTED]>
escribió:
> i am designing a desktop search engine using python.
> i am having a query , is there a package available that contains
> functions for retrieving the files being edited , created,deleted in
> the file system.
For window
On Apr 16, 1:08 pm, Michael Hoffman <[EMAIL PROTECTED]> wrote:
> CSUIDL PROGRAMMEr wrote:
> > hi folks
> > I am new to python. I have a module does call a os.command(cmd) where
> > cmd is a rpm command.
> > Instead of using os.command and getting the results on command line ,
> > i would like to du
En Fri, 20 Apr 2007 15:28:51 -0300, Bjoern Schliessmann
<[EMAIL PROTECTED]> escribió:
> Luis M. González wrote:
>
>> I don't remember exactly where I read about it, but Guido said
>> once that tuples are being kept mainly for historical reasons.
>
> Weren't tuples added when lists already existe
En Fri, 20 Apr 2007 14:28:00 -0300, Larry Bates <[EMAIL PROTECTED]>
escribió:
> Bill Jackson wrote:
>> What is the benefit of clearing a dictionary, when you can just reassign
>> it as empty?
>
> If you have objects that point to the dictionary (something like a cache)
> then you want to clear t
On Apr 20, 3:28 pm, Bjoern Schliessmann wrote:
> Luis M. González wrote:
> > I don't remember exactly where I read about it, but Guido said
> > once that tuples are being kept mainly for historical reasons.
>
> Weren't tuples added when lists already existed?
>
> Regards,
>
> Björn
>
> --
> BOFH e
En Fri, 20 Apr 2007 17:48:10 -0300, CSUIDL PROGRAMMEr
<[EMAIL PROTECTED]> escribió:
> On Apr 16, 1:08 pm, Michael Hoffman <[EMAIL PROTECTED]> wrote:
>> CSUIDL PROGRAMMEr wrote:
>> > hi folks
>> > I am new to python. I have a module does call a os.command(cmd) where
>> > cmd is a rpm command.
>>
On Apr 21, 1:36 am, "Gabriel Genellina" <[EMAIL PROTECTED]>
wrote:
> En Fri, 20 Apr 2007 17:06:51 -0300, rohit <[EMAIL PROTECTED]>
> escribió:
>
>
> For windows you can use the techniques described
> here:http://tgolden.sc.sabren.com/python/win32_how_do_i/watch_directory_fo...
>
> --
> Gabriel Gen
Dennis Lee Bieber <[EMAIL PROTECTED]> writes:
> But is it a "wrong idea" if 999 people interpret the phrase one way,
> and just 1 insists upon an interpretation that, while correct in a small
> technical area, results in misunderstanding when speaking with the other
> 999?
You remind me of
Roel Schroeven wrote:
> Hendrik van Rooyen schreef:
>> "Steve Holden" <[EMAIL PROTECTED]> wrote:
>>
>>
>>> Perhaps in Belgium they prefer climbing mountains over walking up and
>>> down gentle hills?
>>
>> Mountains ? Hills ? In Belgium ??
>>
>> Its not called the battlefield of Europe f
[EMAIL PROTECTED] wrote:
> Hi, I am learning Numpy and using it for a course project.
Welcome! You might want to ask more numpy questions on the numpy mailing list.
Answers to numpy questions here tend to be hit-or-miss.
http://www.scipy.org/Mailing_Lists
> Suppose x = [0, 1, 2, 3, 4], I know
hg schreef:
> Roel Schroeven wrote:
>
>> Hendrik van Rooyen schreef:
>>> "Steve Holden" <[EMAIL PROTECTED]> wrote:
>>>
>>>
Perhaps in Belgium they prefer climbing mountains over walking up and
down gentle hills?
>>> Mountains ? Hills ? In Belgium ??
>>>
>>> Its not called the batt
Gabriel Genellina wrote:
> En Fri, 20 Apr 2007 14:28:00 -0300, Larry Bates
> <[EMAIL PROTECTED]> escribió:
>
>> Bill Jackson wrote:
>>> What is the benefit of clearing a dictionary, when you can just reassign
>>> it as empty?
>>
>> If you have objects that point to the dictionary (something like a
Hi,
On Apr/20/2007, Gabriel Genellina wrote:
> En Fri, 20 Apr 2007 17:06:51 -0300, rohit <[EMAIL PROTECTED]>
> escribió:
>
> > i am designing a desktop search engine using python.
> > i am having a query , is there a package available that contains
> > functions for retrieving the files being
On Apr 20, 6:09 pm, Bjoern Schliessmann wrote:
> [EMAIL PROTECTED] wrote:
> > Please help me think of an example where immutable tuples are
> > essential.
>
> When used as dictionary keys (also everywhere else where they must
> be in a constant order).
>
> Yes, this *is* used in practice.
>
Yup -
On Apr 20, 9:12 am, Steven D'Aprano
<[EMAIL PROTECTED]> wrote:
> On Thu, 19 Apr 2007 13:57:16 -0700, Boris Dusek wrote:
> >> > what is the use-case of parameter "start" in string's "endswith"
> >> > method?
>
> >> def foo(function,instance,param):
> >> if function(instance,param,2,4):
> >>
Can any of you guy's out there point me to information on automating
GUI's that use Tkinter.
I would like to find out more and possibly get involved if there are any
projects under development.
Thanks in advance.
Steve
--
http://mail.python.org/mailman/listinfo/python-list
> The article explains that, amongst other things, tuples are faster
> than lists, so if you are working with constant values (inmutables)
> they are more indicated than lists.
Thanks. I thought Python's design wasn't so concerned with
optimizations.
Adding a new type "just" for optimization re
On Apr 21, 7:09 am, Luis M. González <[EMAIL PROTECTED]> wrote:
> On Apr 20, 3:28 pm, Bjoern Schliessmann
> [EMAIL PROTECTED]> wrote:
> > Luis M. González wrote:
> > > I don't remember exactly where I read about it, but Guido said
> > > once that tuples are being kept mainly for historical reasons
On Apr 20, 4:37 pm, John Machin <[EMAIL PROTECTED]> wrote:
> One inessential but very useful thing about tuples when you have a lot
> of them is that they are allocated the minimum possible amount of
> memory. OTOH lists are created with some slack so that appending etc
> can avoid taking quadratic
[EMAIL PROTECTED] wrote:
> On Apr 20, 4:37 pm, John Machin <[EMAIL PROTECTED]> wrote:
>
>>One inessential but very useful thing about tuples when you have a lot
>>of them is that they are allocated the minimum possible amount of
>>memory. OTOH lists are created with some slack so that appending et
Thanks. I didn't know numpy can do vector indexing as in Matlab.
--
http://mail.python.org/mailman/listinfo/python-list
Rhamphoryncus <[EMAIL PROTECTED]> wrote:
>The only code that will be changed is that which doesn't handle
>surrogates properly. Some will start working properly. Some (ie
>random.choice(u'\U0010\u')) will fail explicitly (rather than
>silently).
You're falsely assuming that any code tha
In article <[EMAIL PROTECTED]>,
Stephen Lewitowski <[EMAIL PROTECTED]> wrote:
>Can any of you guy's out there point me to information on automating
>GUI's that use Tkinter.
>
>I would like to find out more and possibly get involved if there are any
> projects under development.
> I don't believe this specific variant has been discussed.
Now that you clarify it: no, it hasn't been discussed. I find that
not surprising - this proposal is so strange and unnatural that
probably nobody dared to suggest it.
> s[5] does not exist. You would get an IndexError indicating that i
> well i tried reading that but that way i'll have to make the program
> monitor each and every directory.
> when a file is created or deleted or filename modified , a call must
> be made to the os kernel .
> isn't there any way i can utilize that with any api or package
> functions so that i can m
On Thursday 19 April 2007 22:38, Marcpp wrote:
> Hi, I'm introducing to program in python + pyqt.
> I have a main window that call a second window (to introduce a info
> with textedit)
> when press the second window button I need to return to the main
> window the info
> introduced in the second w
On Thursday 19 April 2007 00:50, Glen wrote:
> What seems to be happening is that the font that pyqt is using is not
> fixed width, so I did this:
> qTxtFormat = QTextCharFormat()
> qTxtFormat.setFontFixedPitch(True)
> ui.textEdit.setCurrentCharFormat(qTxtFormat)
It may be that the font you're us
On Tuesday 17 April 2007 07:42, Glen wrote:
> I've written a script in python and put together a simple QFrame with a
> QTextBrowser with Designer. I've translated the C++ into python using
> puic4.
Just to avoid any misunderstanding: the form is actually stored as XML. You
can create C++
On Fri, 20 Apr 2007 09:48:07 -0700, Bill Jackson wrote:
> What is the benefit of clearing a dictionary, when you can just reassign
> it as empty?
They are two different things. In the first place, you clear the
dictionary. In the second place, you reassign the name to a new object
(which may be
Steven W. Orr wrote:
> I really tried. I give up.
>
> I got this one last time (for which I'm very grateful).
> ... Now I want something that's going to give me a string whose value is the
> set of all of the first letters of months. Order is not important.
>
> And for extra credit, I need the s
On Fri, 20 Apr 2007 15:21:56 -0700, John Machin wrote:
> On Apr 20, 9:12 am, Steven D'Aprano
> <[EMAIL PROTECTED]> wrote:
>> On Thu, 19 Apr 2007 13:57:16 -0700, Boris Dusek wrote:
>> >> > what is the use-case of parameter "start" in string's "endswith"
>> >> > method?
>>
>> >> def foo(function,ins
On Fri, 20 Apr 2007 15:53:45 -0700, garrickp wrote:
> Speaking of inessential but very useful things, I'm also a big fan of
> the tuple swap...
> a = 2
> b = 3
> (a, b) = (b, a)
Since tuples are made by commas, not brackets, that can be written more
cleanly as:
a, b = b, a
The only exception is
On Fri, 20 Apr 2007 15:36:00 -0700, [EMAIL PROTECTED] wrote:
>
>
>> The article explains that, amongst other things, tuples are faster
>> than lists, so if you are working with constant values (inmutables)
>> they are more indicated than lists.
>
> Thanks. I thought Python's design wasn't so c
On Apr 20, 5:49 pm, Ross Ridge <[EMAIL PROTECTED]>
wrote:
> Rhamphoryncus <[EMAIL PROTECTED]> wrote:
> >The only code that will be changed is that which doesn't handle
> >surrogates properly. Some will start working properly. Some (ie
> >random.choice(u'\U0010\u')) will fail explicitly (
On Fri, 20 Apr 2007 12:15:33 -0700, kyosohma wrote:
> One hack to make it work is to add the following line right before you
> print "projectOptions":
>
> projectOptions.pop(0) # pop the first element out of the list
Which will introduce a nice bug into the Original Poster's code when the
input
En Fri, 20 Apr 2007 23:13:23 -0300, Steven D'Aprano
<[EMAIL PROTECTED]> escribió:
> On Fri, 20 Apr 2007 15:21:56 -0700, John Machin wrote:
>
>> On Apr 20, 9:12 am, Steven D'Aprano
>> <[EMAIL PROTECTED]> wrote:
>>>
>>> You can do this:
>>>
>>> p = 0
>>> while text:
>>> p = text.find('parrot',
On Apr 20, 6:21 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote:
> > I don't believe this specific variant has been discussed.
>
> Now that you clarify it: no, it hasn't been discussed. I find that
> not surprising - this proposal is so strange and unnatural that
> probably nobody dared to suggest
I'm running Python2.5 with wxPython v2.8.3.0 under WinXP and I cannot
get the SetDefaultStyle method to work.
I'm trying:
self.output.SetDefaultStyle(wx.TextAttr(wx.RED))
self.output.AppendText(text)
self.output.SetDefaultStyle(wx.TextAttr())
where "self.output" is a Text
Gabriel Genellina <[EMAIL PROTECTED]> wrote:
> En Fri, 20 Apr 2007 11:40:00 -0300, Alex Martelli <[EMAIL PROTECTED]>
> escribió:
>
> > I'm still interested to know where that erroneous quote from Alan Isaac
> > comes from, because if it's in Python's docs, it can be fixed.
>
> It was a partial
Is there any easy way to transfer 4 bit integer on socket?
I want to send like this:
a=5
send_integer(socket_s,a)
and receive like this:
a=receive_integer(socket_s)
Sending and receiving is in binary form, not transfer it to string.
Is there any easy way to do this?
--
http://mail.python.org/
En Fri, 20 Apr 2007 23:48:58 -0300, Frank Potter <[EMAIL PROTECTED]>
escribió:
> Is there any easy way to transfer 4 bit integer on socket?
Extend it to 8 bits (1 byte) and use a single character (string of length
1)
> I want to send like this:
>
> a=5
> send_integer(socket_s,a)
socket_s.se
En Fri, 20 Apr 2007 23:48:02 -0300, Alex Martelli <[EMAIL PROTECTED]> escribió:
> Gabriel Genellina <[EMAIL PROTECTED]> wrote:
>
>> Reference Manual, 5.9 Comparisons
>>
>> "The objects need not have the same type. If both are numbers, they are
>> converted to a common type. Otherwise, objects of d
On Fri, 20 Apr 2007 03:28:22 -0700, Rob Wolfe wrote:
>> > The following thread has various ideas in it:
>> > http://mail.python.org/pipermail/python-list/2001-October/107989.html
>>
>> thanks mike, i found that thread before i posted here, it doesn'rt
>> answer my question though.
>
> Why not? Did
On Fri, 20 Apr 2007 09:45:16 -0400, Kevin Walzer wrote:
> PySol has an HTML viewer. Here's a link to some discusison about it:
>
> http://mail.python.org/pipermail/tkinter-discuss/2006-
January/000614.html
>
> PySol is GPL, so if your application is also GPL, then it might be an
> option.
thank
On Thu, 19 Apr 2007 23:42:49 -0700, Glenn Hutchings wrote:
> On 20 Apr, 02:54, "Stephen M. Gava" <[EMAIL PROTECTED]>
> wrote:
>> yeah. i feel like i'm being forced to use wxwidgets/wxpython just
>> because i need pretty good html display though.
>
> You could always use a real web browser:
>
>
hi, I have a question about how to use .grid_forget (in python/TK)
I need to work on grid repeatly. everytime when a button is pressed,
the rows of grid is different. such like, first time, it generate 10
rows of data.
2nd time, it maybe only 5 rows. so I need a way to RESET the grid data
every t
On Fri, 20 Apr 2007 23:20:39 -0300, Gabriel Genellina wrote:
>>> ... but increases the care and attention required when coding:
>>
>> There are always trade-offs.
>
> ... and you still need more attention when replying - read again your own
> reply :)
D'oh!
--
Steven.
--
http://mail.pyt
Here's a strange little bug. "socket.getaddrinfo" blows up
if given a bad domain name containing ".." in Unicode. The
same string in ASCII produces the correct "gaierror" exception.
Actually, this deserves a documentation mention. The "socket" module,
given a Unicode string, calls the
Stefan,
This package is looking better I tried the validation example, but it
did not work
with 1.3beta so I grabbed 1.2. If objectify works well I think this is a
great pick for anyone using xml. Please post to me and the python announce
when 1.3 is released.
thanks,
Len
Stefan Behnel wrote:
Paul Boddie:
> Do we have a volunteer? ;-)
I won't volunteer to do a real implementation - the Unicode type in
Python is currently around 7000 lines long and there is other code to
change in, for example, regular expressions. Here's a demonstration C++
implementation that stores an array o
101 - 178 of 178 matches
Mail list logo