[David Rasmussen]
>> I use urllib2 to do some simple HTTP communication with a web server.
>> In one "session", I do maybe 10-15 requests. It seems that urllib2
>> opens op a connection every time I do a request. Can I somehow make it
>> use _one_ persistent connection where I can do multiple GE
Steven D'Aprano <[EMAIL PROTECTED]> writes:
> Why does the byte string "\x6f\x70\x65\x6e\x65\x64" have intrinsic
> meaning when the int 0 doesn't? It certainly doesn't mean anything to
> non-English speakers.
>
> If all you want is human readable byte strings, then just use them:
>
> class MyFile:
[David Rasmussen]
>> I use urllib2 to do some simple HTTP communication with a web server.
>> In one "session", I do maybe 10-15 requests. It seems that urllib2
>> opens op a connection every time I do a request. Can I somehow make it
>> use _one_ persistent connection where I can do multiple GET->
Hi, I am new in Python programming. Can anybody give me any idea about
how to detect more than one date and time (like 11/11/2005 ,
10-12-2006, 12:30 etc) from a text file and keep them in a list.
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> Hi, I am new in Python programming. Can anybody give me any idea about
> how to detect more than one date and time (like 11/11/2005 ,
> 10-12-2006, 12:30 etc) from a text file and keep them in a list.
well first we read the file
src = file("/your/file").read()
then we
amfr wrote:
> I was wondering how i could parse the contents of a file into an array.
> the file would look something like this:
>
> gif:image/gif
> html:text/html
> jpg:image/jpeg
> ...
>
> As you can see, it contains the mime type and the file extension
> seperated by commas, 1 per line. I wa
Thanks. It was like 911
--
http://mail.python.org/mailman/listinfo/python-list
Thanks a lot. The webserver I am writing works now :)
--
http://mail.python.org/mailman/listinfo/python-list
Leif K-Brooks wrote:
> line = line.rsplit('\r\n')
Er, that should be line.rstrip, not line.rsplit.
--
http://mail.python.org/mailman/listinfo/python-list
Ron wrote:
> Surprising to myself, this was all that it took to make this work. So I'm
> not sure why this method was left out. Could it have been an oversight?
It could be an oversight. More likely, it was not originally there when
the underlying tix library was developed, and only added to t
[EMAIL PROTECTED] wrote:
> Hi, I am new in Python programming. Can anybody give me any idea about
> how to detect more than one date and time (like 11/11/2005 ,
> 10-12-2006, 12:30 etc) from a text file and keep them in a list.
http://docs.python.org/lib/bltin-file-objects.html
http://docs.pytho
hello all when i run the code : # -*- coding: cp1256 -*-from nltk.tagger import *from nltk.corpus import brownfrom nltk.tokenizer import WhitespaceTokenizer # Tokenize ten texts from the Brown Corpustrain_tokens = []xx=Token(TEXT=open('fataha2.txt').read())WhitespaceTokenizer().tokenize(xx)f
john boy wrote:
[top-posting corrected]
>
> Steve Holden <[EMAIL PROTECTED]> wrote:john boy wrote:
>
>>using the following program:
>>
>>fruit = "banana"
>>index = 0
>>while index < len (fruit):
>>letter = fruit[index-1]
>>print letter
>>index= index -1
>>
>>this program is supposed to spell "ban
On Mon, 14 Nov 2005, enas khalil wrote:
> hello all
[program cut]
Hi Enas,
You may want to try talking with NTLK folks about this, as what you're
dealing with is a specialized subject. Also, have you gone through the
tokenization tutorial in:
http://nltk.sourceforge.net/tutorial/tok
This is not really a Python question, but a question on how to use the
nltk package. I've never used, installed nor even seen that package, so
of course I can't answer your question, but I do have a suggestion.
A quick goggle finds a web page for nltk: http://nltk.sourceforge.net/.
Is that where
Ben Bush said unto the world upon 2005-11-14 05:51:
> I have four lists:
> lisA=[1,2,3,4,5,6,9]
> lisB=[1,6,5]
> lisC=[5,6,3]
> lisD=[11,14,12,15]
> how can I write a function to compare lisB, lisC and lisD with lisA, if they
> share two continuous elements (the order does not matter), then return
Para Windows:
import win32api
handle = win32api.OpenProcess(1, False, pid_del_proceso)
win32api.TerminateProcess(handle, -1)
win32api.CloseHandle(handle)
"Yves Glodt" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Andres de la Cuadra wrote:
> > Hola, me llamo Andres de la cuadra,
"Peter Hansen" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Fredrik Lundh wrote:
> > Daniel Crespo wrote:
> >>os.spawnl(os.P_NOWAIT, "c:/windows/notepad.exe")
> >>>1944
> >>
> >>I don't get the correct PID.
> >>
> >>When I do os.spawnl(os.P_NOWAIT, "c:/windows/notepad.exe")
>
Ben Bush wrote:
> is there any python code doing this:
> there are two line segments (2x+y-1=0 with the coordinates of two ending
> points are (1,-1) and (-1,3);
> x+y+6=0 with the coordinates of two ending points are (-3,-3) and
> (-4,-2);). They extend and when they meet each other, stop extendin
I am fairly new to programming in Python. There are a number of cases
where I would like to see examples of programs written. I like to
write them on Windows and in some cases put them on my Linux server to
do something useful.
I am also interested in using Telnet to check services and things on
Having fixed a memory leak (not the leak of a Python reference, some
other stuff I wasn't properly freeing in certain cases) in a C-coded
extension I maintain, I need a way to test that the leak is indeed
fixed. Being in a hurry, I originally used a q&d hack...:
if sys.platform in ('linux2', 'da
Thank you all for your great help. One of the few things better than
python is the knowledgeable community around it. : )
Regards,
Mack
--
http://mail.python.org/mailman/listinfo/python-list
Brian van den Broek <[EMAIL PROTECTED]> wrote:
> Ben Bush said unto the world upon 2005-11-14 05:51:
> > I have four lists:
> > lisA=[1,2,3,4,5,6,9]
> > lisB=[1,6,5]
> > lisC=[5,6,3]
> > lisD=[11,14,12,15]
> > how can I write a function to compare lisB, lisC and lisD with lisA, if they
> > share t
Brian van den Broek wrote:
> Ben Bush said unto the world upon 2005-11-14 05:51:
>
>> I have four lists:
>> lisA=[1,2,3,4,5,6,9]
>> lisB=[1,6,5]
>> lisC=[5,6,3]
>> lisD=[11,14,12,15]
>> how can I write a function to compare lisB, lisC and lisD with lisA,
>> if they
>> share two continuous elements
Björn Lindström wrote:
> So, I guess no one read my explanation of why this an issue about more
> than implementing enums (which is fairly trivial, as we have seen).
I read it. I don't see that it is an issue, and I
especially don't see why it is relevent to Pierre's
usage of symbols.
In your
Tony Nelson wrote:
> >Can I get over this performance problem without reimplementing the
> >whole thing using a barebones list object? I though I was being "smart"
> >by avoiding editing the long list, but then it struck me that I am
> >creating a second object of the same size when I put the modi
I have some code that looks something like this:
from ftplib import FTP
ftp = FTP()
# connect and login
ftp.connect(server_name)
ftp.login(user_name, password)
cmd = "STOR %s" % filename
#"ASCII transfer"
l = open(filename)
ftp.storlines(cmd, l)
#"BIN transfer"
l = open(filename, 'rb')
ftp.storbi
Steven D'Aprano <[EMAIL PROTECTED]> wrote:
> On Mon, 14 Nov 2005 17:15:04 +0100, Pierre Barbier de Reuille wrote:
> > The key point that, I think, you misunderstand is that symbols are
> > not *variables* they are *values*.
>
> Python doesn't have variables. It has names and objects.
That seems t
Björn Lindström <[EMAIL PROTECTED]> wrote:
> So, I guess no one read my explanation of why this an issue about
> more than implementing enums (which is fairly trivial, as we have
> seen).
I read it. I see that something more than enums is being asked for.
What I don't see is a use case where this
Post/View Open Source Jobs
http://groups.yahoo.com/group/opensourcejobs
--
http://mail.python.org/mailman/listinfo/python-list
Not sure if I should start a new thread or not, but
since this is closely related, I'll just leave it as is.
Alex Martelli wrote:
> Having fixed a memory leak (not the leak of a Python reference, some
> other stuff I wasn't properly freeing in certain cases) in a C-coded
> extension I maintain,
Steven D'Aprano <[EMAIL PROTECTED]> wrote:
> Not sure if I should start a new thread or not, but
> since this is closely related, I'll just leave it as is.
>
> Alex Martelli wrote:
>
> > Having fixed a memory leak (not the leak of a Python reference, some
> > other stuff I wasn't properly freei
Paul Watson wrote:
> I cannot yet get tkinter working on 2.4.2. I have installed the tk rpms
> from FC4. I have checked to see that TKPATH is available in
> Modules/Setup.
>
> How can I verify that I have tcl/tk installed correctly and it is the
> correct version (8+)?
Surely, there must be
what does the following code mean?
if item in list2: if item + 1 in list1 and item + 1 in list2:
On 11/14/05, Brian van den Broek <[EMAIL PROTECTED]> wrote:
Ben Bush said unto the world upon 2005-11-14 05:51:> I have four lists:> lisA=[1,2,3,4,5,6,9]
> lisB=[1,6,5]> lisC=[5
Hijacking Brian's response since my newsserver never god Ben's originalrequest...:I would program this at a reasonably high abstraction level, based on
sets -- since you say order doesn't matter, sets are more appropriatethan lists anyway. For example:def two_cont_in_common(x, y): common = set(
When I run scripts in PythonWin,
sometimes will get the message of invalid syntax error.
How can I check which error I made?
For example, in VB, you might got the wrong place highlighted and help message too.-- Thanks!Ben Bush
--
http://mail.python.org/mailman/listinfo/python-list
[snip]That's potentially very expensive for large lists, although simplyconverting the lists to sets should give a significant speed up. I
think the following is *possibly* as good a way as any.>>> def compare(list1, list2): intersection = sorted(list(set(list1) & set(list2))) for i i
Alex Martelli wrote:
>
> So, I thought I'd turn to the "wisdom of crowds"... how would YOU guys
> go about adding to your automated regression tests one that checks that
> a certain memory leak has not recurred, as cross-platform as feasible?
> In particular, how would you code _memsize() "cross-pl
. maybe you could separate your code into parts { python std, pythonwin-specific},
and then use a debugger to know most of the problem sources?
(I'm not familiar with pythonwin, I assume it's a superset of python std) .On 11/14/05, Ben Bush <[EMAIL PROTECTED]
> wrote:When I run scripts in PythonWin
I somehow missed this reply posted two weeks ago.
<[EMAIL PROTECTED]> wrote:
> "Neat, though non-trivial XSLT makes my head spin."
>
> Well, you don't have to know XSLT at all to use the Examplotron
> transform, although I can understand wanting to understand and hack
> what you're using.
>
> "Ju
Ben Bush said unto the world upon 2005-11-14 23:20:
>
> On 11/14/05, Brian van den Broek <[EMAIL PROTECTED]> wrote:
>
>>Ben Bush said unto the world upon 2005-11-14 05:51:
>>
>>>I have four lists:
>>>lisA=[1,2,3,4,5,6,9]
>>>lisB=[1,6,5]
>>>lisC=[5,6,3]
>>>lisD=[11,14,12,15]
>>>how can I write
My suggestion would also be to use sbrk() as it provides a high-water
mark for the memory usage of the process.
Below is the function hiwm() I used on Linux (RedHat). MacOS X and
Unix versions are straigthforward. Not sure about Windows.
/Jean Brouwers
#if _LINUX
#include
size_t hiwm (void)
On 11/14/05, adDoc's networker Phil <[EMAIL PROTECTED]> wrote:
. maybe you could separate your code into parts { python std, pythonwin-specific},and then use a debugger to know most of the problem sources?
(I'm not familiar with pythonwin, I assume it's a superset of python std) .
On 11/14/05, Be
Hi Brian,
regarding "if item + 1 in list1 and item + 1 in list2:",
my understanding is this will check whether the following item in each list is the same. How does the code permit the situation that the order does not matter?
For example, for lisA and lisB, the comparison is true and the two lis
> Hey Ben,
>
> first, as expected, the other two answers you received are better. :-)
>
> Sets are much better optimized for things like membership testing than
> are lists. I'm not competent to explain why; indeed, I keep
> overlooking them myself :-(
>
> Unfortunately, the indents got screwed up
Erik Max Francis <[EMAIL PROTECTED]> wrote:
> Bruno Desthuilliers wrote:
>
>> Depends on the country's laws and the exact agreement.
>
> Work for hire is part of the Berne convention.
>
According to recent (2003) Slovak copyright law, ONLY the individual
authors own the copyright, and they cann
On 11/14/05, Ben Bush <[EMAIL PROTECTED]> wrote:
Hijacking Brian's response since my newsserver never god Ben's originalrequest...:I would program this at a reasonably high abstraction level, based on
sets -- since you say order doesn't matter, sets are more appropriatethan lists anyway. For e
101 - 147 of 147 matches
Mail list logo