computer support

2008-08-28 Thread atrooja1998
hello every body in the group -- http://mail.python.org/mailman/listinfo/python-list

Python-2.3.4 on OSF1 V4.0?

2008-08-28 Thread Ivo Raisr
Hi Edmond and any interested reader, I've successfully patched _socket extension of python 2.5.1 to build on OSF1 V4.0 with gcc 4.1.2. The following construct is put right after #include "Python.h" and #include "structmember.h": #define _POSIX_PII_SOCKET #define _LIBC_POLLUTION_H_ Ivosh Raisr -- h

Re: Lining Up and PaddingTwo Similar Lists

2008-08-28 Thread Paul Rubin
"W. eWatson" <[EMAIL PROTECTED]> writes: > [a.dat, c.dat, g.dat, k.dat, p.dat] > [a.txt, b.txt, g.txt, k.txt r.txt, w.txt] > > What I need is to pair up items with the same prefix and use "None", > or some marker, to indicate the absence of the opposite item. This is functionally influenced but

Re: Tough Guy Competition

2008-08-28 Thread alex23
On Aug 29, 3:45 pm, "W. eWatson" <[EMAIL PROTECTED]> wrote: > Something to do on your weekends. [non-related link clipped] Another thing to do with your weekends would be to -not spam-. -- http://mail.python.org/mailman/listinfo/python-list

Re: Multiple values for one key

2008-08-28 Thread Willi Richert
Hi, try defaultdict: In [1]: from collections import defaultdict In [2]: d=defaultdict(list) In [3]: d[1].append(7) In [4]: d[1].append(8) In [5]: d Out[5]: defaultdict(, {1: [7, 8]}) In [6]: d[1] Out[6]: [7, 8] Regards, wr Am Donnerstag 28 August 2008 19:02:55 schrieb Ron Brennan: > I hav

Re: Lining Up and PaddingTwo Similar Lists

2008-08-28 Thread castironpi
On Aug 29, 12:29 am, "W. eWatson" <[EMAIL PROTECTED]> wrote: > castironpi wrote: > > > This gets you your list.  What do you mean by 'missing member of > > (a.dat, a.txt) is a pair. (None, a.txt) has a.dat missing. I just need to > issue a msg to the user that one member of a file pair is missing.

Re: iterating over two arrays in parallel?

2008-08-28 Thread Terry Reedy
[EMAIL PROTECTED] wrote: I want to interate over two arrays in parallel, something like this: a=[1,2,3] b=[4,5,6] for i,j in a,b: print i,j where i,j would be 1,4,2,5, 3,6 etc. Is this possible? How to fish for yourself: search 'Python loop two arrays parallel'

Re: Fastest way to write huge files

2008-08-28 Thread Terry Reedy
Mohamed Yousef wrote: Hello , let's say , I'm moving large files through network between devices what is the fastest way to do this ? what i came up with :- Use your OS's network copy command. On unix, that was once uucp. On Windows, I drag-and-drop to/from a Network Neighborhood location

Re: Python sockets UDP broadcast multicast question??

2008-08-28 Thread castironpi
On Aug 28, 1:09 am, inorlando <[EMAIL PROTECTED]> wrote: > Hi all, > > I have a question about python and sockets , UDP datagram in > particular. I'm new to socket programming so please bare with me. > > I am trying to write a simple application that broadcast files to > another computer on the sam

Tough Guy Competition

2008-08-28 Thread W. eWatson
Something to do on your weekends. -- W. Watson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time) Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet -- http://mail.python.org/mailman/listinfo/pyth

Re: [1,2,3] exactly same as [1,2,3,] ?

2008-08-28 Thread Terry Reedy
[EMAIL PROTECTED] wrote: x=[1,2,3] and x=[1,2,3,] are exactly the same, right? Yes, so you can write something like either your second example or l = [ kjasldfjs, kjsalfj, ksjdflasj, ] and insert items without worrying about leaving out the comma (less of a problem with 'horizontal'

Professional Grant Proposal Writing Workshop (September 2008: British Columbia Institute of Technology - Vancouver Campus)

2008-08-28 Thread Anthony Jones
The Grant Institute's Grants 101: Professional Grant Proposal Writing Workshop will be held at the British Columbia Institute of Technology - Vancouver Campus, September 29 - October 1, 2008. Interested development professionals, researchers, faculty, and graduate students should register as soo

Re: Lining Up and PaddingTwo Similar Lists

2008-08-28 Thread W. eWatson
castironpi wrote: On Aug 28, 10:50 pm, "W. eWatson" <[EMAIL PROTECTED]> wrote: Maybe there's some function like zip or map that does this. If not, it's probably fairly easy to do with push and pop. I'm just checking to see if there's not some known simple single function that does what I want. H

Re: Python in a Nutshell -- Book vs Web

2008-08-28 Thread Fredrik Lundh
Cameron Laird wrote: No. No, to an almost libelous extent. No matter what you write about, there's always a certain subcategory of potential readers who insist that collection, editing, filtering, structuring, clarification, and the author's real-life experience of the topic he's writing

Re: Checking if the file is a symlink fails

2008-08-28 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: Do you mean the following is deprecated ? http://docs.python.org/lib/module-stat.html From the documentation - S_ISLNK( mode) Return non-zero if the mode is from a symbolic link. As that page states, that's a function used to interpret a mode flag returned by

Re: Python sockets UDP broadcast multicast question??

2008-08-28 Thread inorlando
On Aug 28, 8:06 am, Francesco Bochicchio <[EMAIL PROTECTED]> wrote: > On 28 Ago, 08:09, inorlando <[EMAIL PROTECTED]> wrote: > > > > > Hi all, > > > I have a question about python and sockets , UDP datagram in > > particular. I'm new to socket programming so please bare with me. > > > I am trying t

subclassing complex

2008-08-28 Thread BiDi
I have been trying to subclass complex, but I am not able to get the right-hand arithmetic operators working. As shown below, if an object of my subclass 'xcomplex' is added on the right of a 'comlex' object, the type returned is 'complex', not 'xcomplex'. I've tried subclassing float and it work

Re: Checking if the file is a symlink fails

2008-08-28 Thread Miles
saswat wrote: > On Aug 28, 3:11 pm, Christian Heimes wrote: >> [EMAIL PROTECTED] wrote: >> > File symLinkTest is a symbolic link. >> >> > Why S_ISLNK(mode) returns False and S_ISREG(mode) returns True ? >> >> Because you are using os.stat() instead of os.lstat(). > > Do you mean the following is de

Re: Lining Up and PaddingTwo Similar Lists

2008-08-28 Thread castironpi
On Aug 28, 10:50 pm, "W. eWatson" <[EMAIL PROTECTED]> wrote: > Maybe there's some function like zip or map that does this. If not, it's > probably fairly easy to do with push and pop. I'm just checking to see if > there's not some known simple single function that does what I want. Here's > what I'

Lining Up and PaddingTwo Similar Lists

2008-08-28 Thread W. eWatson
Maybe there's some function like zip or map that does this. If not, it's probably fairly easy to do with push and pop. I'm just checking to see if there's not some known simple single function that does what I want. Here's what I'm trying to do. I have a list dat like (assume the items are str

Re: Python in a Nutshell -- Book vs Web

2008-08-28 Thread Benjamin Kaplan
On Thu, Aug 28, 2008 at 7:58 PM, Cameron Laird <[EMAIL PROTECTED]> wrote: > In article < > [EMAIL PROTECTED]>, > Matimus <[EMAIL PROTECTED]> wrote: > >On Aug 28, 3:05 pm, "W. eWatson" <[EMAIL PROTECTED]> wrote: > >> I read an Amazon of Python in a Nutshell. The first edition is > supposedly > >>

Re: iterating over two arrays in parallel?

2008-08-28 Thread Luis Zarrabeitia
Quoting [EMAIL PROTECTED]: > I want to interate over two arrays in parallel, something like this: > > a=[1,2,3] > b=[4,5,6] > > for i,j in a,b: > print i,j > > where i,j would be 1,4,2,5, 3,6 etc. > > Is this possible? Yeap. === for i,j in zip(a,b): print i,j

Re: Fastest way to write huge files

2008-08-28 Thread James Mills
Hi, You could use generators connected via a pipe or tcp socket ... cheers James On Fri, Aug 29, 2008 at 10:35 AM, Mohamed Yousef <[EMAIL PROTECTED]> wrote: > Hello , > > let's say , I'm moving large files through network between devices > what is the fastest way to do this ? > what i came up wi

Re: Fastest way to write huge files

2008-08-28 Thread [EMAIL PROTECTED]
On Aug 28, 5:35 pm, "Mohamed Yousef" <[EMAIL PROTECTED]> wrote: > Hello , > > let's say , I'm moving large files through network between devices > what is the fastest way to do this ? > what i came up with :- > > 1) using regular file operations with an in memory limit of 4MB which > when filled wr

Re: iterating over two arrays in parallel?

2008-08-28 Thread skip
> "mark" == mh <[EMAIL PROTECTED]> writes: mark> I want to interate over two arrays in parallel, something like this: mark> a=[1,2,3] mark> b=[4,5,6] mark> for i,j in a,b: mark> print i,j mark> where i,j would be 1,4,2,5, 3,6 etc. a =

iterating over two arrays in parallel?

2008-08-28 Thread mh
I want to interate over two arrays in parallel, something like this: a=[1,2,3] b=[4,5,6] for i,j in a,b: print i,j where i,j would be 1,4,2,5, 3,6 etc. Is this possible? Many TIA! Mark -- Mark Harrison Pixar Animation Studios -- http://mail.python.org/mailman/listi

Re: eval() == evil? --- How to use it safely?

2008-08-28 Thread Paul Rubin
"James Mills" <[EMAIL PROTECTED]> writes: > If you cannot use a simple data structure/format > like JSON, or CSV, or similar, _don't_ > use eval or exec, but use the pickle > libraries instead. This is much safer. Pickle uses eval and should also be considered unsafe, as its documentation describe

Re: eval() == evil? --- How to use it safely?

2008-08-28 Thread Paul Rubin
Fett <[EMAIL PROTECTED]> writes: > However, this means that I am using eval() on some string on a web- > site, which seems pretty un-safe. Don't even think of doing that. > I read that by using eval(code,{"__builtins__":None},{}) It is not reliable enough. Don't use eval for this AT ALL. > -

Fastest way to write huge files

2008-08-28 Thread Mohamed Yousef
Hello , let's say , I'm moving large files through network between devices what is the fastest way to do this ? what i came up with :- 1) using regular file operations with an in memory limit of 4MB which when filled written to disk and re-filled again 2) using memory mapped files in the followi

Re: exactly same as [1,2,3,] ?

2008-08-28 Thread Patrick Maupin
On Aug 28, 6:35 pm, "James Mills" <[EMAIL PROTECTED]> wrote: > I must point out though that although they contain > the same elements/data, they are not the same > object/instance. > > {{{ > #!python > > >>> x = [1, 2, 3] > >>> y = [1, 2, 3] > >>> id(x) > 3083095148L > >>> id(y) > 3082953324L > >>>

Re: eval() == evil? --- How to use it safely?

2008-08-28 Thread Steven D'Aprano
On Thu, 28 Aug 2008 14:51:57 -0700, Fett wrote: > I read that by using eval(code,{"__builtins__":None},{}) I can prevent > them from using pretty much anything, No, it can prevent them from some obvious dangers, but not all obvious dangers and possibly not unobvious ones. > and my nested dicti

Re: Python in a Nutshell -- Book vs Web

2008-08-28 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Matimus <[EMAIL PROTECTED]> wrote: >On Aug 28, 3:05 pm, "W. eWatson" <[EMAIL PROTECTED]> wrote: >> I read an Amazon of Python in a Nutshell. The first edition is supposedly >> much like the web site. What web site? The second edition apparently adds >> more to the b

Re: [Q] How to ignore the first line of the text read from a file

2008-08-28 Thread Steven D'Aprano
On Thu, 28 Aug 2008 15:11:39 -0700, Dennis Lee Bieber wrote: > On 28 Aug 2008 19:32:45 GMT, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > >> On Thu, 28 Aug 2008 10:16:45 -0700, norseman wrote: >> > import os >> > >> > file = open(filename, 'r') >>

Re: eval() == evil? --- How to use it safely?

2008-08-28 Thread Matimus
On Aug 28, 3:09 pm, "Guilherme Polo" <[EMAIL PROTECTED]> wrote: > On Thu, Aug 28, 2008 at 6:51 PM, Fett <[EMAIL PROTECTED]> wrote: > > I am creating a program that requires some data that must be kept up > > to date. What I plan is to put this data up on a web-site then have > > the program periodi

Re: Tkinter event loop question

2008-08-28 Thread Russell E. Owen
In article <[EMAIL PROTECTED]>, gordon <[EMAIL PROTECTED]> wrote: > On Aug 27, 10:42 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > > so I guess the question here is from where you expect to call that > > method, and what you expect Tkinter to do when you call it... > > thanks for the reply >

Re: eval() == evil? --- How to use it safely?

2008-08-28 Thread castironpi
On Aug 28, 4:51 pm, Fett <[EMAIL PROTECTED]> wrote: > I am creating a program that requires some data that must be kept up > to date. What I plan is to put this data up on a web-site then have > the program periodically pull the data off the web-site. > > My problem is that when I pull the data (cu

Re: Checking if the file is a symlink fails

2008-08-28 Thread [EMAIL PROTECTED]
On Aug 28, 3:11 pm, Christian Heimes <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > File symLinkTest is a symbolic link. > > > Why S_ISLNK(mode) returns False and S_ISREG(mode) returns True ? > > Because you are using os.stat() instead of os.lstat(). > > http://docs.python.org/lib/os-fil

Re: [1,2,3] exactly same as [1,2,3,] ?

2008-08-28 Thread Paul McNett
James Mills wrote: I must point out though that although they contain the same elements/data, they are not the same object/instance. True, but the OP wanted equality: > I want to be > sure I'm generating an equivalent data structure. Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: eval() == evil? --- How to use it safely?

2008-08-28 Thread James Mills
Hi, If you cannot use a simple data structure/format like JSON, or CSV, or similar, _don't_ use eval or exec, but use the pickle libraries instead. This is much safer. cheers James On Fri, Aug 29, 2008 at 7:51 AM, Fett <[EMAIL PROTECTED]> wrote: > I am creating a program that requires some data

Re: [1,2,3] exactly same as [1,2,3,] ?

2008-08-28 Thread James Mills
On Fri, Aug 29, 2008 at 9:28 AM, Paul McNett <[EMAIL PROTECTED]> wrote: > When confronted with this type of question, I ask the interpreter: > > {{{ > mac:~ pmcnett$ python > Python 2.5.2 (r252:60911, Feb 22 2008, 07:57:53) > [GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin > Type "help", "c

Re: [1,2,3] exactly same as [1,2,3,] ?

2008-08-28 Thread mh
Paul McNett <[EMAIL PROTECTED]> wrote: > When confronted with this type of question, I ask the interpreter: > >>> [1,2,3] == [1,2,3,] > True Well I guess that's a pretty authoritative answer... thanks! -- Mark Harrison Pixar Animation Studios -- http://mail.python.org/mailman/listinfo/python-li

Re: [1,2,3] exactly same as [1,2,3,] ?

2008-08-28 Thread Paul McNett
[EMAIL PROTECTED] wrote: x=[1,2,3] and x=[1,2,3,] are exactly the same, right? When confronted with this type of question, I ask the interpreter: {{{ mac:~ pmcnett$ python Python 2.5.2 (r252:60911, Feb 22 2008, 07:57:53) [GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin Type "help", "co

[1,2,3] exactly same as [1,2,3,] ?

2008-08-28 Thread mh
x=[1,2,3] and x=[1,2,3,] are exactly the same, right? I'm generating some python data, and it's less error prone to not treat the last element specially, but I want to be sure I'm generating an equivalent data structure. Many TIA! Mark -- Mark Harrison Pixar Animation Studios -- http://mail.py

Re: eval() == evil? --- How to use it safely?

2008-08-28 Thread James Matthews
I had an issue once that i was getting true and false statements in text and needed to convert them into Python boolean objects. So i wrote a function to parse the text. and return True or False based on the text. On Thu, Aug 28, 2008 at 3:09 PM, Guilherme Polo <[EMAIL PROTECTED]> wrote: > On Thu

Re: Identifying the start of good data in a list

2008-08-28 Thread tdmj
On Aug 27, 11:50 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Tue, 26 Aug 2008 17:04:19 -0700, tdmj wrote: > > On Aug 26, 5:49 pm, [EMAIL PROTECTED] wrote: > >> I have a list that starts with zeros, has sporadic data, and then has > >> good data. I define the point at whi

Re: Python in a Nutshell -- Book vs Web

2008-08-28 Thread Matimus
On Aug 28, 3:05 pm, "W. eWatson" <[EMAIL PROTECTED]> wrote: > I read an Amazon of Python in a Nutshell. The first edition is supposedly > much like the web site. What web site? The second edition apparently adds > more to the book than the web site. O'Reilly seems to just read all of the available

Re: Wild Card String Comparison

2008-08-28 Thread W. eWatson
Cameron Laird wrote: In article <[EMAIL PROTECTED]>, W. eWatson <[EMAIL PROTECTED]> wrote: Is it possible to do a search for a wild card string in another string. For example, I'd like to find "v*.dat" in a string called bingo. v must be matched against only the first character in bingo, and no

Re: Checking if the file is a symlink fails

2008-08-28 Thread Christian Heimes
[EMAIL PROTECTED] wrote: File symLinkTest is a symbolic link. Why S_ISLNK(mode) returns False and S_ISREG(mode) returns True ? Because you are using os.stat() instead of os.lstat(). http://docs.python.org/lib/os-file-dir.html Christian -- http://mail.python.org/mailman/listinfo/python-list

Python in a Nutshell -- Book vs Web

2008-08-28 Thread W. eWatson
I read an Amazon of Python in a Nutshell. The first edition is supposedly much like the web site. What web site? The second edition apparently adds more to the book than the web site. -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.015 Deg. W, 39.262 Deg

Re: eval() == evil? --- How to use it safely?

2008-08-28 Thread Guilherme Polo
On Thu, Aug 28, 2008 at 6:51 PM, Fett <[EMAIL PROTECTED]> wrote: > I am creating a program that requires some data that must be kept up > to date. What I plan is to put this data up on a web-site then have > the program periodically pull the data off the web-site. > > My problem is that when I pull

Re: How to ignore the first line of the text read from a file

2008-08-28 Thread Terry Reedy
Santiago Romero wrote: I want to read text line-by-line from a text file, but want to ignore only the first line. I know how to do it in Java (Java has been my primary language for the last couple of years) and following is what I have in Python, but I don't like it and want to learn the better

Re: eval() == evil? --- How to use it safely?

2008-08-28 Thread Jean-Paul Calderone
On Thu, 28 Aug 2008 14:51:57 -0700 (PDT), Fett <[EMAIL PROTECTED]> wrote: I am creating a program that requires some data that must be kept up to date. What I plan is to put this data up on a web-site then have the program periodically pull the data off the web-site. My problem is that when I pu

Re: eval() == evil? --- How to use it safely?

2008-08-28 Thread Bruno Desthuilliers
Fett a écrit : I am creating a program that requires some data that must be kept up to date. What I plan is to put this data up on a web-site then have the program periodically pull the data off the web-site. My problem is that when I pull the data (currently stored as a dictionary on the site)

Checking if the file is a symlink fails

2008-08-28 Thread [EMAIL PROTECTED]
check if file is a symlink Here is a small piece of code: import os from stat import * filePath = "/home/xyz/symLinkTest" mode = os.stat(filePath)[ST_MODE] print 'Find using os.path : ',os.path.islink(filePath) print 'Find using mode :', S_ISLNK(mode) print 'Is this a regular file : ' S_ISREG(

eval() == evil? --- How to use it safely?

2008-08-28 Thread Fett
I am creating a program that requires some data that must be kept up to date. What I plan is to put this data up on a web-site then have the program periodically pull the data off the web-site. My problem is that when I pull the data (currently stored as a dictionary on the site) off the site, it

Re: Negative regular expressions (searching for "i" not inside command)

2008-08-28 Thread Terry Reedy
Bart Kastermans wrote: I have a file in which I am searching for the letter "i" (actually a bit more general than that, arbitrary regular expressions could occur) as long as it does not occur inside an expression that matches \\.+?\b (something started by a backslash and including the word that

Re: Problem with list.insert

2008-08-28 Thread Terry Reedy
SUBHABRATA, I recommend you study this excellent response carefully. castironpi wrote: On Aug 28, 11:13 am, SUBHABRATA <[EMAIL PROTECTED]> wrote: -. Instead split up your inputs first thing. trans= { 'a': 'A', 'at': 'AT', 'to': 'TO' } sample= 'a boy at the park walked to the tree' expected= '

Re: Negative regular expressions (searching for "i" not inside command)

2008-08-28 Thread castironpi
On Aug 28, 4:04 pm, "Guilherme Polo" <[EMAIL PROTECTED]> wrote: > On Thu, Aug 28, 2008 at 5:04 PM, Bart Kastermans > > <[EMAIL PROTECTED]> wrote: > > I have a file in which I am searching for the letter "i" (actually > > a bit more general than that, arbitrary regular expressions could > > occur) a

Re: Negative regular expressions (searching for "i" not inside command)

2008-08-28 Thread Guilherme Polo
On Thu, Aug 28, 2008 at 5:04 PM, Bart Kastermans <[EMAIL PROTECTED]> wrote: > I have a file in which I am searching for the letter "i" (actually > a bit more general than that, arbitrary regular expressions could > occur) as long as it does not occur inside an expression that matches > \\.+?\b (som

Re: Descriptor leak in python 2.4 subprocess module

2008-08-28 Thread Michel Lespinasse
On Thu, Aug 28, 2008 at 10:37:48AM +0100, Tim Golden wrote: > Michel Lespinasse wrote: > >I hit an issue with the following python code: > >try: > >get_orient = subprocess.Popen (['jpegexiforient', '-n', pathfull], > > stdin = subprocess.PIPE, > >

Re: Syntax error in ".py" file and globals variable values not available.

2008-08-28 Thread Timothy Grant
On Thu, Aug 28, 2008 at 1:40 AM, Alexis Boutillier <[EMAIL PROTECTED]> wrote: > Timothy Grant a écrit : >> >> On Wed, Aug 27, 2008 at 2:49 AM, Alexis Boutillier >> <[EMAIL PROTECTED]> wrote: >>> >>> Hi, >>> >>> I have a strange behaviour of python with pdb and import statement. >>> Here is the exam

Negative regular expressions (searching for "i" not inside command)

2008-08-28 Thread Bart Kastermans
I have a file in which I am searching for the letter "i" (actually a bit more general than that, arbitrary regular expressions could occur) as long as it does not occur inside an expression that matches \\.+?\b (something started by a backslash and including the word that follows). More concrete e

Re: Python svn bindings for Subversion?

2008-08-28 Thread Matthew Woodcraft
Mike B writes: > I'm trying to get Subversion 'hook scripts' working on an Ubuntu box and the > following fails. > > from svn import fs, repos, core, delta [...] > 'svn' appears to be a SWIG wrapper and could be what I'm looking for, but I > cannot find it anywhere. > > Can anyone point me in the r

Re: Python svn bindings for Subversion?

2008-08-28 Thread Rob Wolfe
Mike B <[EMAIL PROTECTED]> writes: > I'm trying to get Subversion 'hook scripts' working on an Ubuntu box and the > following fails. > > from svn import fs, repos, core, delta > > As far as I can tell there are two Python Subversion libraries, 'pysvn' and > 'svn': > 'pysvn' from http://pysvn.tigri

Re: filter in for loop

2008-08-28 Thread Emile van Sebille
Jerry Hill wrote: On Thu, Aug 28, 2008 at 6:20 AM, GHZ <[EMAIL PROTECTED]> wrote: is there a shortcut I'm missing? import glob Emile -- http://mail.python.org/mailman/listinfo/python-list

Re: filter in for loop

2008-08-28 Thread Matthew Woodcraft
GHZ <[EMAIL PROTECTED]> writes: > I would like to say something like: > > for filename in os.listdir(DIR) if filename[-4:] == '.xml': > > > > instead of having to say: > > for filename in os.listdir(DIR): > if filename[-4:] == '.xml': > If the reason you don't like this one is t

Re: List of modules available for import inside Python?

2008-08-28 Thread mblume
Am Thu, 28 Aug 2008 11:23:01 -0700 schrieb Jason Scheirer: > > I like to direct new users to pydoc's built-in HTTP server: > > import pydoc > pydoc.gui() > (then click the 'open browser' button) > Now, this is cool ! Thanks a lot! Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: file data to list

2008-08-28 Thread Emile van Sebille
Anish Chapagain wrote: Hi!! I am facing problem for extracting file data to the list so as to have graph plotted through list. my file(eg: data.txt) is having data like this, cnt0001a 29000 xretya 01 cnt0002a 29850 brishal 02 cnt0003a 31250 kristal 03 from here, I need to copy data 29000, 29850

Re: [Q] How to ignore the first line of the text read from a file

2008-08-28 Thread Marc 'BlackJack' Rintsch
On Thu, 28 Aug 2008 10:16:45 -0700, norseman wrote: > Benjamin Kaplan wrote: >> On Thu, Aug 28, 2008 at 12:11 AM, [EMAIL PROTECTED] < >> [EMAIL PROTECTED]> wrote: >> >>> Hello, >>> >>> I am new to Python and have one simple question to which I cannot find >>> a satisfactory solution. >>> I want t

Re: re.compile versus r''

2008-08-28 Thread Chris Rebert
On Thu, Aug 28, 2008 at 12:23 PM, Terrence Brannon <[EMAIL PROTECTED]> wrote: > Hello, I'm using a tool (PLY) which apparently expects the tokens to > be created using r'' > > But because one token is a rather complex regular expression, I want > to create the regular expression programmatically. >

Re: re.compile versus r''

2008-08-28 Thread Fredrik Lundh
Terrence Brannon wrote: Hello, I'm using a tool (PLY) which apparently expects the tokens to be created using r'' But because one token is a rather complex regular expression, I want to create the regular expression programmatically. How can I generate a string and then create something of the

Re: Python multimap

2008-08-28 Thread Carl Banks
On Aug 28, 2:41 pm, brad <[EMAIL PROTECTED]> wrote: > Carl Banks wrote: > > Out of curiosity, what does a true multimap solve that a dictionary of > > lists not solve? > > Nothing really. I went with a variation of the suggested work around... > it's just that with Python I don't normally have to u

Re: re.compile versus r''

2008-08-28 Thread Terrence Brannon
Oh my god, how embarrassing. the r'' notation is to create raw string I thought it was some form of blessing a string into a regular expression class. -- http://mail.python.org/mailman/listinfo/python-list

Re: file data to list

2008-08-28 Thread Marc 'BlackJack' Rintsch
On Thu, 28 Aug 2008 12:11:39 -0700, Anish Chapagain wrote: > I am facing problem for extracting file data to the list so as to have > graph plotted through list. > my file(eg: data.txt) is having data like this, > > cnt0001a 29000 xretya 01 > cnt0002a 29850 brishal 02 > cnt0003a 31250 kristal 03

[MacOS X] plat-mac/errors.rsrc.df.rsrc not installed/created

2008-08-28 Thread Christian Ebert
Hi, I am on MacOS 10.4.11, and have a minor recurring problem, when using my own Python installation. I only stumbled over it when using http operations with the Mercurial SCM, and my /tmp/ folder was clobbered with *.rsrc temporary files. Some references: http://www.selenic.com/pipermail/mercur

Re: Sending e-mail

2008-08-28 Thread gordyt
Peter here is an example. I just tried it and it works fine. from smtplib import SMTP HOST = "smtp.gmail.com" PORT = 587 ACCOUNT = "" # put your gmail email account name here PASSWORD = "" # put your gmail email account password here def send_email(to_addrs, subject, msg): server = SMTP(HO

re.compile versus r''

2008-08-28 Thread Terrence Brannon
Hello, I'm using a tool (PLY) which apparently expects the tokens to be created using r'' But because one token is a rather complex regular expression, I want to create the regular expression programmatically. How can I generate a string and then create something of the same type that the r'' fun

Re: file data to list

2008-08-28 Thread bearophileHUGS
Anish Chapagain: > cnt0001a 29000 xretya 01 > cnt0002a 29850 brishal 02 > cnt0003a 31250 kristal 03 > from here, I need to copy data 29000, 29850, 31250 into a single list > and > 01, 02, 03 to another so as to plot graph using these value. This may offer you a starting point: >>> line = "cnt0003

Re: ImageTk.Photoimage not displayed

2008-08-28 Thread Guilherme Polo
On Thu, Aug 28, 2008 at 4:07 PM, harryos <[EMAIL PROTECTED]> wrote: > hi > i am trying to display an image on a canvas in a gui made with Tkinter > widgets > > > class PhotoDisplay: >def __init__(self,parent): >self.mainframe = Frame(parent,background="grey") >. >#ad

Wholesale Air Jordan Six Rings (6 IX Rings) sneakers (www.sneakers-in-china.com)

2008-08-28 Thread www.sneakers-in-china.com
(ww w.sneakers-in-china.com)air max 87 89 90 95 ltd timberland jeans ugg boots lacoste sandals hoodies,t-shirts,mauri shoes,dsquared,hogan shoes,dunks,red monkey,polo t-shirts, evisu jeans, bbc jeans,dior,lv,dg,versace,coach puma shoes,nfl jerseys shox r2 r3 r4 r5 r6 tn tl1 tl3, sandals, nhl jersey

file data to list

2008-08-28 Thread Anish Chapagain
Hi!! I am facing problem for extracting file data to the list so as to have graph plotted through list. my file(eg: data.txt) is having data like this, cnt0001a 29000 xretya 01 cnt0002a 29850 brishal 02 cnt0003a 31250 kristal 03 from here, I need to copy data 29000, 29850, 31250 into a single lis

ImageTk.Photoimage not displayed

2008-08-28 Thread harryos
hi i am trying to display an image on a canvas in a gui made with Tkinter widgets class PhotoDisplay: def __init__(self,parent): self.mainframe = Frame(parent,background="grey") . #added a subframe to hold canvas and button self.canvFrame=Frame(

Re: Sending e-mail

2008-08-28 Thread Vistro
I used that code before, and it did not do what it needed to do. If you are just sending text, this usually works for me. def sendMail(): ## Parameters for SMTP session port=587 SMTPserver= 'smtp.gmail.com' SMTPuser= 'gmail username, which is your gmail address' pw= 'your gma

Re: Sending e-mail

2008-08-28 Thread Waldemar Osuch
On Aug 28, 12:52 pm, [EMAIL PROTECTED] wrote: > I work at a training center and I would like to use Python to generate > a number of certificates and then e-mail them. The certificates are a > problem for another day - right now I just want to figure out how to > send an e-mail. > > I confess I don

Sending e-mail

2008-08-28 Thread peter . jones . rpi
I work at a training center and I would like to use Python to generate a number of certificates and then e-mail them. The certificates are a problem for another day - right now I just want to figure out how to send an e-mail. I confess I don't know much about the protocol(s) for e-mail. In PHP usi

Re: Problem with list.insert

2008-08-28 Thread castironpi
On Aug 28, 11:13 am, SUBHABRATA <[EMAIL PROTECTED]> wrote: > Dear Group, > I wrote one program, > There is a dictionary. > There is an input string. > Every word of input string the word is matched against the dictionary > If the word of input string is matched against the dictionary it gives > the

Re: Pythoncom and pywintypes

2008-08-28 Thread Vistro
A Reinstall seems to have done nothing... On Thu, Aug 28, 2008 at 4:49 AM, Gabriel Genellina <[EMAIL PROTECTED]>wrote: > En Wed, 27 Aug 2008 21:17:22 -0300, Vistro <[EMAIL PROTECTED]> escribi�: > > Hey, there. I've been coding in python for about three weeks now. I have >> made basic games, tool

Re: struct.Struct random access

2008-08-28 Thread castironpi
On Aug 28, 1:59 am, Tim Roberts <[EMAIL PROTECTED]> wrote: > castironpi <[EMAIL PROTECTED]> wrote: > > >I'd like to seriously nominate this idea and get a considered opinion > >on it. > > >struct.Struct lets you encode Python objects into structured memory. > >It accepts a format string, and option

Re: Multiple values for one key

2008-08-28 Thread Chris Rebert
On Thu, Aug 28, 2008 at 10:02 AM, Ron Brennan <[EMAIL PROTECTED]> wrote: > I have another question. > > How would like to be able to add the contents on the values for one key. > > key['20001']:[978, 345] I'm assuming that by this you meant: assert the_dict['20001'] == [978, 345] > > How can I do

Re: Python multimap

2008-08-28 Thread brad
Carl Banks wrote: Out of curiosity, what does a true multimap solve that a dictionary of lists not solve? Nothing really. I went with a variation of the suggested work around... it's just that with Python I don't normally have to use work arounds and normally one obvious approach is correct:

Re: no string.downer() ?

2008-08-28 Thread Fredrik Lundh
Tobiah wrote: Never ascribe to humour that which can be adequately explained by increadible stupidity! I love the irony. Muphry's law. -- http://mail.python.org/mailman/listinfo/python-list

Re: epoch seconds from a datetime

2008-08-28 Thread Richard Rossel
On 28 ago, 14:25, "Chris Rebert" <[EMAIL PROTECTED]> wrote: > On Thu, Aug 28, 2008 at 10:18 AM, Richard Rossel <[EMAIL PROTECTED]> wrote: > > Hi friends, > > I need a little help here, I 'm stuck with epoch calculation issue. > > I have this datetime: > > date_new = datetime(*time.strptime('2008010

Re: Identifying the start of good data in a list

2008-08-28 Thread castironpi
On Aug 27, 3:42 pm, George Sakkis <[EMAIL PROTECTED]> wrote: > Below are two more versions that pass all the doctests: the first > works only for lists and modifies them in place and the second works > for arbitrary iterables: > > def clean_inplace(seq, good_ones=4): >     start = 0 >     n = len(s

Re: no string.downer() ?

2008-08-28 Thread Tobiah
> Never ascribe to humour that which can be adequately explained by > increadible stupidity! I love the irony. Don't feel bad. I recently corrected someone's 'grammer' with a similar tone. ** Posted from http://www.teranews.com ** -- http://mail.python.org/mailman/listinfo/python-list

Re: epoch seconds from a datetime

2008-08-28 Thread Chris Rebert
On Thu, Aug 28, 2008 at 10:18 AM, Richard Rossel <[EMAIL PROTECTED]> wrote: > Hi friends, > I need a little help here, I 'm stuck with epoch calculation issue. > I have this datetime: > date_new = datetime(*time.strptime('20080101T00','%Y%m%dT%H%M%S') > [0:6]) > This date_new is in UTC > Now I

Re: List of modules available for import inside Python?

2008-08-28 Thread Jason Scheirer
On Aug 27, 11:04 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > ssecorp wrote: > > Is there a way to view all the modules I have available for import > > from within Python? > > Like writing in the interpreter: > > import.modules > > there's a helper script in the 2.5 source code kit that locates a

Re: Problem with list.insert

2008-08-28 Thread bearophileHUGS
Subhabrata, it's very difficult for me to understand what your short program has to do, or what you say. I think that formatting and code style are important. So I suggest you to give meaningful names to all your variable names, to remove unused variables (like n), to add blank likes here and ther

Re: Python svn bindings for Subversion?

2008-08-28 Thread Benjamin Kaplan
On Thu, Aug 28, 2008 at 11:22 AM, Mike B <[EMAIL PROTECTED]> wrote: > I'm trying to get Subversion 'hook scripts' working on an Ubuntu box and > the > following fails. > > from svn import fs, repos, core, delta > > As far as I can tell there are two Python Subversion libraries, 'pysvn' and > 'svn'

Re: Problem with list.insert

2008-08-28 Thread Diez B. Roggisch
Diez B. Roggisch schrieb: SUBHABRATA schrieb: Some people in the room told I am kidding, but I learnt Python from Python docs which gives examples like these, But I write explicit comments, an excerpt from python docs: # Measure some strings: ... a = ['cat', 'window', 'defenestrate'] for x in a

Re: Problem with list.insert

2008-08-28 Thread Diez B. Roggisch
SUBHABRATA schrieb: Some people in the room told I am kidding, but I learnt Python from Python docs which gives examples like these, But I write explicit comments, an excerpt from python docs: # Measure some strings: ... a = ['cat', 'window', 'defenestrate'] for x in a: ... print x, len(x)

  1   2   >