Re: I am a Java Programmer

2005-06-30 Thread George Sakkis
"[EMAIL PROTECTED]" wrote: > I am a java programmer and I want to learn Python Please help me. Google Is Your Friend: http://www.razorvine.net/python/PythonForJavaProgrammers http://www.ferg.org/projects/python_java_side-by-side.html George -- http://mail.python.org/mailman/listinfo/python-li

I am a Java Programmer

2005-06-30 Thread mjmrifai
I am a java programmer and I want to learn Python Please help me. -- http://mail.python.org/mailman/listinfo/python-list

Re: Splitting string into dictionary

2005-06-30 Thread George Sakkis
"David Pratt" > Thanks George! You guys are great! I am always learning. Python is > awesome!! Yeap, that was the reaction of many/most of us when we stumbled upon python. Welcome aboard ! George -- http://mail.python.org/mailman/listinfo/python-list

Re: Splitting string into dictionary

2005-06-30 Thread David Pratt
Thanks George! You guys are great! I am always learning. Python is awesome!! On Friday, July 1, 2005, at 02:33 AM, George Sakkis wrote: > "Robert Kern" wrote: > >> Ignore the last message. >> >> translations = [x.strip(" '") for x in line.split('|')] >> d = dict(zip(translations[::2], transla

Re: Speaking of list-comprehension?

2005-06-30 Thread George Sakkis
"Terry Hancock" wrote: > Chinook wrote: > > >>> ta = [5, 15, 12, 10, 9] > > >>> for i in range(len(ta)): > > ... if ta[i] >= 10: > > ... ta[i] -= 10 > > ... else: > > ... ta[i] += 10 > > It's not exactly the same in that it doesn't change values in > place, but this is similar if you

Re: Splitting string into dictionary

2005-06-30 Thread George Sakkis
"David Pratt" wrote: > Wow Robert that is incredible python magic! I am trying to figure out > what this is doing since my attempts were regex and some long string > splitting and collection. > > Ok. So it is a list comprehension and then collection. What is zip > doing in the second line? > > R

Re: Splitting string into dictionary

2005-06-30 Thread David Pratt
Pretty amazing Devan! Great regex! Thank you. Regards, David On Friday, July 1, 2005, at 02:29 AM, Devan L wrote: > One line solution. > dict(re.findall(r"'(.+?)' \| '(.+?)'(?:\s\||$)",yourtexthere)) > > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mai

Re: Splitting string into dictionary

2005-06-30 Thread David Pratt
Wow Robert that is incredible python magic! I am trying to figure out what this is doing since my attempts were regex and some long string splitting and collection. Ok. So it is a list comprehension and then collection. What is zip doing in the second line? Regards David On Friday, July 1,

Re: Splitting string into dictionary

2005-06-30 Thread George Sakkis
"Robert Kern" wrote: > Ignore the last message. > > translations = [x.strip(" '") for x in line.split('|')] > d = dict(zip(translations[::2], translations[1::2])) Or in case you're working with a lot and/or huge records, the second line can be more efficiently written as: from itertools import i

Re: Splitting string into dictionary

2005-06-30 Thread Devan L
One line solution. dict(re.findall(r"'(.+?)' \| '(.+?)'(?:\s\||$)",yourtexthere)) -- http://mail.python.org/mailman/listinfo/python-list

Re: Escaping commas within parens in CSV parsing?

2005-06-30 Thread gene tani
Why don't you use a different delimiter when you're writing the CSV? -- http://mail.python.org/mailman/listinfo/python-list

Re: Speaking of list-comprehension?

2005-06-30 Thread Terry Hancock
On Thursday 30 June 2005 10:13 pm, Chinook wrote: > >>> ta = [5, 15, 12, 10, 9] > >>> for i in range(len(ta)): > ... if ta[i] >= 10: > ... ta[i] -= 10 > ... else: > ... ta[i] += 10 It's not exactly the same in that it doesn't change values in place, but this is similar if you are onl

Re: Splitting string into dictionary

2005-06-30 Thread Robert Kern
David Pratt wrote: > I have string text with language text records that looks like this: > > 'en' | 'the brown cow' | 'fr' | 'la vache brun' > > Two or more language records can exist in each string (example above > shows 2 - but could contain more) > The second vertical line character in the ex

Re: Speaking of list-comprehension?

2005-06-30 Thread Steven Bethard
Chinook wrote: > >>> ta = [5, 15, 12, 10, 9] > >>> for i in range(len(ta)): > ... if ta[i] >= 10: > ... ta[i] -= 10 > ... else: > ... ta[i] += 10 > ... > >>> ta > [15, 5, 2, 0, 19] One possibility: py> [(tai + 10, tai - 10)[tai >= 10] for tai in ta] [15, 5, 2, 0, 19] But see: htt

Re: Speaking of list-comprehension?

2005-06-30 Thread George Sakkis
"Chinook" wrote: > I'm probably just getting languages mixed up, but I thought in my Python > readings over the last couple months that I had noticed an either/or > expression (as opposed to a bitwise or, or truth test). Being a curious > sort, I tried several variations of how a list comprehensi

Re: Splitting string into dictionary

2005-06-30 Thread Robert Kern
David Pratt wrote: > I have string text with language text records that looks like this: > > 'en' | 'the brown cow' | 'fr' | 'la vache brun' > > Two or more language records can exist in each string (example above > shows 2 - but could contain more) > The second vertical line character in the ex

Splitting string into dictionary

2005-06-30 Thread David Pratt
I have string text with language text records that looks like this: 'en' | 'the brown cow' | 'fr' | 'la vache brun' Two or more language records can exist in each string (example above shows 2 - but could contain more) The second vertical line character in the example above is the record break

Re: aligning text with space-normalized text

2005-06-30 Thread Steven Bethard
John Machin wrote: > Steven Bethard wrote: > >> John Machin wrote: >> >>> For example, text = 'foo bar', chunks = ['foobar'] >> >> This doesn't match the (admittedly vague) spec > > That is *exactly* my point -- it is not valid input, and you are not > reporting all cases of invalid input; you h

Re: Lost in a sea of documentation...can you point me in the right direction?

2005-06-30 Thread Andrew Durdin
On 30 Jun 2005 14:38:17 -0700, MooMaster <[EMAIL PROTECTED]> wrote: > So I started reading about os, threads, > and the path for the special folders in the archives and in the Python > docs and I'm kind of lost because there aren't many concrete examples > in the documentation. Can anyone point me

Re: How to run commands in command line from a script

2005-06-30 Thread Peter Hansen
Peter Hansen wrote: > Ivan Shevanski wrote: >> Alright well I'm quite a noob and when I run a simple command to >> change the current directory, nothing happens. I made a little test >> script to show it: > > Generally, the only way to use an application (i.e. a program like the > Python inter

Re: How to run commands in command line from a script

2005-06-30 Thread Peter Hansen
Ivan Shevanski wrote: > Alright well I'm quite a noob and when I run a simple command to change > the current directory, nothing happens. I made a little test script to > show it: > > > import os > cwd = os.getcwd() > print cwd > os.system('cd = C:\Program Files') > print cwd There are at lea

Re: OOP help needed incorporating existing modules in class

2005-06-30 Thread Peter Hansen
Koncept wrote: > I want to incorporate the datetime and other modules into my class. I > am new to Python and would really appreciate some help doing this. > > class FooBar: >def getDate(self): > return > > ^^^ how do I do something like this? Um have you read the tutorial yet? I

Re: How to run commands in command line from a script

2005-06-30 Thread Robert Kern
Ivan Shevanski wrote: > Alright well I'm quite a noob and when I run a simple command to change > the current directory, nothing happens. I made a little test script to > show it: > > import os > cwd = os.getcwd() > print cwd > os.system('cd = C:\Program Files') > print cwd > > then the result

Re: How to run commands in command line from a script

2005-06-30 Thread Ivan Shevanski
Alright well I'm quite a noob and when I run a simple command to change the current directory, nothing happens. I made a little test script to show it: import os cwd = os.getcwd() print cwd os.system('cd = C:\Program Files') print cwd then the result: C:\Python24\Python Scripts C:\Python24\

Re: Escaping commas within parens in CSV parsing?

2005-06-30 Thread Paul McGuire
Well, this doesn't have the terseness of an re solution, but it shouldn't be hard to follow. -- Paul #~ This is a very crude first pass. It does not handle nested #~ ()'s, nor ()'s inside quotes. But if your data does not #~ stray too far from the example, this will probably do the job. #~ Down

Re: Escaping commas within parens in CSV parsing?

2005-06-30 Thread Devan L
Oops, the above code doesn't quite work. Use this one instead. re.findall(r'(.+? (?:\(.+?\))?)(?:,|$)',yourtexthere) -- http://mail.python.org/mailman/listinfo/python-list

Re: Escaping commas within parens in CSV parsing?

2005-06-30 Thread Devan L
Try this. re.findall(r'(.+? \(.+?\))(?:,|$)',yourtexthere) -- http://mail.python.org/mailman/listinfo/python-list

Speaking of list-comprehension?

2005-06-30 Thread Chinook
I'm probably just getting languages mixed up, but I thought in my Python readings over the last couple months that I had noticed an either/or expression (as opposed to a bitwise or, or truth test). Being a curious sort, I tried several variations of how a list comprehension *might* be construc

Re: How to run commands in command line from a script

2005-06-30 Thread Devan L
The code module, perhaps? http://www.python.org/doc/2.4.1/lib/module-code.html -- http://mail.python.org/mailman/listinfo/python-list

Re: How to run commands in command line from a script

2005-06-30 Thread Robert Kern
Ivan Shevanski wrote: > I know there is an easy way to do this, and I just can not remember. I have > already searched where I thought the module would be. . . I just want to run > some name specific commands. Is this easily possible? Quick and dirty: import os os.system('./some --comman

Re: Escaping commas within parens in CSV parsing?

2005-06-30 Thread Skip Montanaro
Ramon> I am trying to use the csv module to parse a column of values Ramon> containing comma-delimited values with unusual escaping: Ramon> AAA, BBB, CCC (some text, right here), DDD Ramon> I want this to come back as: Ramon> ["AAA", "BBB", "CCC (some text, right here)", "DD

Re: shelve in a ZipFile?

2005-06-30 Thread Robert Kern
Terry Hancock wrote: > I only just recently had a look at the shelve module, and it > looks pretty handy, my only question being, what if I really > want two shelves? Must I use two files? > > Also, it seems strange that shelve only works with > filenames. I would've expected there to at least

Re: Favorite non-python language trick?

2005-06-30 Thread ncf
Sorry, I realized that shortly after my post =X -- http://mail.python.org/mailman/listinfo/python-list

How to run commands in command line from a script

2005-06-30 Thread Ivan Shevanski
I know there is an easy way to do this, and I just can not remember. I have already searched where I thought the module would be. . . I just want to run some name specific commands. Is this easily possible? Thanks, -Ivan _ Expres

Re: Favorite non-python language trick?

2005-06-30 Thread Erik Max Francis
ncf wrote: > Eh, just figured it'd be worth noting...map, filter, and reduce should > be possible with the extended list syntaxes. Well, filter I know is, > but hte others /should/ be possible. > > filter(lambda: <>, <>) > [some_var for some_var in <> if <>] reduce isn't. -- Erik Max Francis &

Re: Favorite non-python language trick?

2005-06-30 Thread ncf
Hmm...I think it's time I do better justice to what I previously wrote. http://www.artima.com/weblogs/viewpost.jsp?thread=98196 The above article was linked by Python's PEP... -- http://mail.python.org/mailman/listinfo/python-list

Re: map vs. list-comprehension

2005-06-30 Thread Roy Smith
Robert Kern <[EMAIL PROTECTED]> wrote: > Looks like the PSU got to yoNO CARRIER No, the trackpad on my PowerBook seems to have gone a little haywire and I'm getting the occasional random mouse click. In that case, it seemed to have clicked the "Post" button. -- http://mail.python.org/mailman/

Re: Favorite non-python language trick?

2005-06-30 Thread ncf
Eh, just figured it'd be worth noting...map, filter, and reduce should be possible with the extended list syntaxes. Well, filter I know is, but hte others /should/ be possible. filter(lambda: <>, <>) [some_var for some_var in <> if <>] Honestly, though, I hope they don't drop the map functions a

Escaping commas within parens in CSV parsing?

2005-06-30 Thread felciano
Hi -- I am trying to use the csv module to parse a column of values containing comma-delimited values with unusual escaping: AAA, BBB, CCC (some text, right here), DDD I want this to come back as: ["AAA", "BBB", "CCC (some text, right here)", "DDD"] I think this is probably non-standard escapi

Threading Question

2005-06-30 Thread ncf
I've used python for a while now, and am startting to dig into threads and sockets (using asyncore/asynchat). Through all this, I've been using the -v option on python to generate verbose output and try to pinpoint any potential problems...however, one warning is eluding me as to it's cause/resolut

shelve in a ZipFile?

2005-06-30 Thread Terry Hancock
I only just recently had a look at the shelve module, and it looks pretty handy, my only question being, what if I really want two shelves? Must I use two files? Also, it seems strange that shelve only works with filenames. I would've expected there to at least be a variant that would put a sh

Re: Scket connection to server

2005-06-30 Thread Christopher Subich
Steve Horsley wrote: > There is a higher level socket framework called twisted that everyone > seems to like. It may be worth looking at that too - haven't got round > to it myself yet. I wouldn't say 'like,' exactly. I've cursed it an awful lot (mostly for being nonobvious), but it does a da

It seems that ZipFile().write() can only write files, how can empty directories be put into it?

2005-06-30 Thread could ildg
I want to "create" a empty folder in a zipfile, Can ZipFile do it? If not, any other approachs? -- http://mail.python.org/mailman/listinfo/python-list

ANN: PL/Py 0.1 Release

2005-06-30 Thread James William Pye
After much hacking, and many liters of caffeinated beverages, it is my pleasure to announce the first development release of PL/Py, the PostgresPy Project[1]'s Backend elements for the PostgreSQL ORDBMS. The very terse project news item can be found here[2]. PL/Py, PostgresPy's Backend Project, i

Re: How to compare two directories?

2005-06-30 Thread could ildg
Thank you~ I get it. On 6/30/05, Michael Hoffman <[EMAIL PROTECTED]> wrote: > could ildg wrote: > > I found dircmp compare only the direct dirs and files, > > and it will not do anything to the sub-directories. > > The documentation for dircmp.report_full_closure() disagrees with you. > -- > Mich

Re: map vs. list-comprehension

2005-06-30 Thread Roy Smith
Terry Hancock <[EMAIL PROTECTED]> wrote: > One of the strengths of Python has been that the language itself is > small (which it shares with C and (if I understand correctly, not being > a lisp programmer?) Lisp), but with all the syntax enhancements going > on, Python is getting pretty complica

Re: map vs. list-comprehension

2005-06-30 Thread Robert Kern
Roy Smith wrote: > Terry Hancock <[EMAIL PROTECTED]> wrote: > >>One of the strengths of Python has been that the language itself is >>small (which it shares with C and (if I understand correctly, not being >>a lisp programmer?) Lisp), but with all the syntax enhancements going >>on, Python is g

Re: map vs. list-comprehension

2005-06-30 Thread Roy Smith
Terry Hancock <[EMAIL PROTECTED]> wrote: > One of the strengths of Python has been that the language itself is > small (which it shares with C and (if I understand correctly, not being > a lisp programmer?) Lisp), but with all the syntax enhancements going > on, Python is getting pretty complica

Re: Favorite non-python language trick?

2005-06-30 Thread Terry Hancock
On Thursday 30 June 2005 10:21 am, [EMAIL PROTECTED] wrote: > If I had to choose one feature, I would like to see better support for > nested lexical scopes. However, I imagine this is no easy "trick" to > add to the language. Doesn't that already happen in versions 2.2+? What exactly do you mea

Re: map vs. list-comprehension

2005-06-30 Thread Terry Hancock
On Thursday 30 June 2005 09:49 am, Mike P. wrote: > That really sucks, I wasn't aware of these plans. Ok, I don't use reduce > much, but I use lambda, map and filter all the time. > [...] > Also, I don't necessarily think list comprehensions are necessarily easier > to read. I don't use them all t

Re: Python for everything?

2005-06-30 Thread Mike Meyer
Ivan Van Laningham <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >> [EMAIL PROTECTED] writes: >> As other have noted, C was never really used for everything. Unix >> tools were designed to connect together from the very beginning, which >> is what makes shell scripting so powerful. This was true

Re: When someone from Britain speaks, Americans hear a "British accent"...

2005-06-30 Thread Terry Hancock
On Thursday 30 June 2005 09:49 am, Benji York wrote: > Graham Fawcett wrote: > > keep-your-stick-on-the-ice'ly yours, > > Is that a Red Green reference? Man, I didn't think this could get any > more off-topic. :) > > python-needs-more-duct-tape'ly yours, No silly, it's "duck typing", not duc

Re: Python for everything?

2005-06-30 Thread Roy Smith
Ivan Van Laningham <[EMAIL PROTECTED]> wrote: > It really was used "for everything"; C compilers have *always* let you > include assembler, with the "asm" keyword. Unless you're talking about > the early days of DOS/Windows compilers, about which I know little, but > all *K&R* compilers had asm.

Re: Python for everything?

2005-06-30 Thread Ivan Van Laningham
Hi All-- Mike Meyer wrote: > > [EMAIL PROTECTED] writes: > > As other have noted, C was never really used for everything. Unix > tools were designed to connect together from the very beginning, which > is what makes shell scripting so powerful. This was true before there > was a C. Likewise, som

Re: I have a question.

2005-06-30 Thread dimitri pater
Hi, here is an example of using the random function I am working at right now (it randomizes (is that a word?) every word in a list): import string import random from itertools import ifilter, ifilterfalse def reinterpolate(word):     #thanks to Raymond Hettinger (taken from the Python list)     w

Re: Using Numeric 24.0b2 with Scientific.IO.NetCDF

2005-06-30 Thread Robert Kern
bandw wrote: > I am having a problem using Numeric-24.0b2 in conjunction with > the NetCDF module from ScientificPython (version 2.4.9). > This problem does not surface using Numeric-23.8. The problem > arises in using the "min" function on a NetCDF floating array. > In 23.8, the "min" function ret

Re: Seeking IDE

2005-06-30 Thread gene tani
I encourage NOPs (non-original posters) to paste their thoughts into the wiki for posterity/FAQing, e.g. currently no info on synEdit: http://wiki.python.org/moin/IntegratedDevelopmentEnvironments -- http://mail.python.org/mailman/listinfo/python-list

Using Numeric 24.0b2 with Scientific.IO.NetCDF

2005-06-30 Thread bandw
I am having a problem using Numeric-24.0b2 in conjunction with the NetCDF module from ScientificPython (version 2.4.9). This problem does not surface using Numeric-23.8. The problem arises in using the "min" function on a NetCDF floating array. In 23.8, the "min" function returns a floating scalar,

OOP help needed incorporating existing modules in class

2005-06-30 Thread Koncept
I want to incorporate the datetime and other modules into my class. I am new to Python and would really appreciate some help doing this. class FooBar: def getDate(self): return ^^^ how do I do something like this? -- Koncept << "The snake that cannot shed its skin perishes. So do th

RE: When someone from Britain speaks, Americans hear a "Britishaccent"...

2005-06-30 Thread Delaney, Timothy (Tim)
Grant Edwards wrote: > On 2005-06-30, Delaney, Timothy (Tim) <[EMAIL PROTECTED]> wrote: >> Tom Anderson wrote: >> >>> How about carrier? >> >> Ends in an "a" (Australian ;) > > Right, but due to some wierd property requiring conservation of > consonants, when speaking Strine you've got to take

Re: Newbie backreference question

2005-06-30 Thread paulm
George Sakkis <[EMAIL PROTECTED]> wrote: > > Did you have a look at my other reply ? It's still the same, just > change the regexp: > > import re > a = 'test string two' > b = re.match(r'test \w{2}(.+)', a, re.DOTALL).group(1) > print b > > By the way, if you want to catch any single character (

Re: Python for everything?

2005-06-30 Thread Mike Meyer
[EMAIL PROTECTED] writes: > I posted a article earlier pertaining programming for my boss. Now I am > gonna ask a question about programming for myself. I just finished my > first C++ Class. Next semester is a class on encryption(and it's > probably gonna be a math class too). And finally back in

Re: Scket connection to server

2005-06-30 Thread Grant Edwards
On 2005-06-30, André Egners <[EMAIL PROTECTED]> wrote: >>> I would like to establish a socket connection to a server >>> running a service on port 2. the host address is >>> 10.214.109.50. how do i do this using python? >>> >>> many thanks >>> >>> >> >> Off the top of my head (so there could

Re: When someone from Britain speaks, Americans hear a "Britishaccent"...

2005-06-30 Thread Grant Edwards
On 2005-06-30, Delaney, Timothy (Tim) <[EMAIL PROTECTED]> wrote: > Tom Anderson wrote: > >> How about carrier? > > Ends in an "a" (Australian ;) Right, but due to some wierd property requiring conservation of consonants, when speaking Strine you've got to take the r's removed from words like "carr

pdf in full-color

2005-06-30 Thread Alberto Vera
Hello.   I got a pdf file from a microsoft word document using Linbox-converter. The problem is that I got a pdf file in white&black color.   Do you know another library to convert this to a full-color? Is it possible to do that using Linbox-converter?   Regards -- http://mail.python.org/ma

Re: Newbie backreference question

2005-06-30 Thread George Sakkis
"paulm" <[EMAIL PROTECTED]> wrote: > No, sorry - my bad. I am looking to assign the > backreference to another variable so it can be treated > seperately. So perhaps: > > $a = 'test string two'; > $a =~ /test \w{2}([\W\w]+)/; > $b = $1; > print $b . "\n"; > > producing "ring two". > > I have read

Re: Python syntax high-lighting and preservation on web

2005-06-30 Thread Ryan Bowman
--- Gregory Piñero <[EMAIL PROTECTED]> wrote: > Hey guys, > > Does anyone know where I can pick up a style sheet (css) and/or other > files/programs I might need to display python code on my website with > tab preservation(or replace with spaces) and colored syntax? I want > something similar

Re: Lost in a sea of documentation...can you point me in the right direction?

2005-06-30 Thread Bruno Desthuilliers
MooMaster a écrit : (snip) > I'd like to write a program that I can pass a path to > (say: My Pictures) and at a timer interval will pick a picture from it > and set my wallpaper to that" So I started reading about os, threads, > and the path for the special folders What's a "special folder" ???

Re: Modules for inclusion in standard library?

2005-06-30 Thread Robert Kern
Mike Meyer wrote: > Harry George <[EMAIL PROTECTED]> writes: > >>b) Installing distutils-aware python packages is trivial. I'd rather >>the energy which might go into a bigger std library go instead into >>helping projects which don't have distutils-style builds. > > How about integrating distut

RE: When someone from Britain speaks, Americans hear a "Britishaccent"...

2005-06-30 Thread Delaney, Timothy (Tim)
Tom Anderson wrote: > How about carrier? Ends in an "a" (Australian ;) Tim Delaney -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie backreference question

2005-06-30 Thread paulm
Larry Bates <[EMAIL PROTECTED]> wrote: > a='test string' > print a.split()[:-1] > > I'm assuming that you want the last space separated word? > > Larry Bates > > > paulm wrote: >> Hi, >> In perl I can do something like: >> >> $a = 'test string'; >> $a =~ /test (\w+)/; >> $b = $1; >> prin

Re: building 2.4.1 on HPUX

2005-06-30 Thread Richard Patterson
In case someone else reads these for information about a simliar problem It turns out, that I did not need to edit the setup.py script, I could just ignore the compile time INFO statements regarding Tk/Tcl libs and includes.. I did need to modify the Modules/Setup file however... But the fina

Re: script fichiers binaires lecture écriture

2005-06-30 Thread Mike Meyer
bruno modulix <[EMAIL PROTECTED]> writes: >> Be aware that I'm >> using pyhton 1.5, > Err... latest is 2.4.1, and the language has really, really changed. You > should consider upgrading... > >> unfortunately... > > BTW, in 1.5.x, you can use the String module instead of string class > methods:

Re: Modules for inclusion in standard library?

2005-06-30 Thread Mike Meyer
Harry George <[EMAIL PROTECTED]> writes: > b) Installing distutils-aware python packages is trivial. I'd rather > the energy which might go into a bigger std library go instead into > helping projects which don't have distutils-style builds. How about integrating distutils and PyPI, so that dist

Re: Newbie backreference question

2005-06-30 Thread George Sakkis
> Hi, > In perl I can do something like: > > $a = 'test string'; > $a =~ /test (\w+)/; > $b = $1; > print $b . "\n"; > > and my output would be "string". > > How might this snippet be written in python? > > Thanks to all... import re a = 'test string' b = re.match(r'test (\w+)', a).group(1) print

Lost in a sea of documentation...can you point me in the right direction?

2005-06-30 Thread MooMaster
I'm a complete beginner in Python, but I've been fooling around with Java for a couple years, so I have decent programming experience... Anyway, I was sitting around playing with Python, when I thought to myself: "I know! I'd like to write a program that I can pass a path to (say: My Pictures) and

Re: Which kid's beginners programming - Python or Forth?

2005-06-30 Thread Mike Meyer
[EMAIL PROTECTED] (Roy Smith) writes: > There's a reprint this morning on slashdot of a 1984 review Byte did > on the brand-new Macintosh (executive summary: cool machine, needs > more memory). The first four software packages available for the new > machine? > > MacWrite/MacPaint (they seem to c

Re: Newbie backreference question

2005-06-30 Thread Robert Kern
paulm wrote: > Hi, > In perl I can do something like: > > $a = 'test string'; > $a =~ /test (\w+)/; > $b = $1; > print $b . "\n"; > > and my output would be "string". > > How might this snippet be written in python? http://docs.python.org/lib/module-re.html -- Robert Kern [EMAIL P

Re: Newbie backreference question

2005-06-30 Thread Larry Bates
a='test string' print a.split()[:-1] I'm assuming that you want the last space separated word? Larry Bates paulm wrote: > Hi, > In perl I can do something like: > > $a = 'test string'; > $a =~ /test (\w+)/; > $b = $1; > print $b . "\n"; > > and my output would be "string". > > Ho

Re: how to shrink a numarray array?

2005-06-30 Thread Diez B. Roggisch
Qiangning Hong wrote: > To draw a large array of data on a small panel, I need to shrink it to a > given size. e.g: > > To draw numarray.arange(1) on a panel of width of 100, I only need > to draw the points of (0, 100, 200, 300, ...) instead of (0, 1, 2, ...). > So I need a method to shrink

Re: Python for everything?

2005-06-30 Thread phil
Python is in my opinion the best "all-purpose" language ever designed ( lisp is extremely cool but not as all purpose.) Much more elegant than perl and far far easier to do cool things than java (java is c++ on valium). HOWEVER, "all purpose" needs a little disclosure. A well coded C program may b

Re: Python for everything?

2005-06-30 Thread Roy Smith
<[EMAIL PROTECTED]> wrote: > I have read in the old days that C was used for everything. It was a > systems programming language, and also did a lot of the same stuff > Bash scripts and perl do now. I learned C in "the old days" (1977 or maybe 78). We had plenty of other tools for scripting. Bef

Newbie backreference question

2005-06-30 Thread paulm
Hi, In perl I can do something like: $a = 'test string'; $a =~ /test (\w+)/; $b = $1; print $b . "\n"; and my output would be "string". How might this snippet be written in python? Thanks to all... -- http://mail.python.org/mailman/listinfo/python-list

Re: Python for everything?

2005-06-30 Thread Larry Bates
Short answer is yes. Longer answer: You will still need C for device drivers and other applications that have high performance demands. Calling C from Python is quite easy. Python can be used from short "shell" scripting to projects that very large (see Zope, Plone, ReportLab, etc). Other than

Re: class attribute to instance attribute

2005-06-30 Thread Devan L
Why make it an instance attribute? Couldn't you just look at the class attribute? If its something that depends on each instance's value assigned to the attribute, why not make it an instance attribute to start with? -- http://mail.python.org/mailman/listinfo/python-list

Re: Python for everything?

2005-06-30 Thread Devan L
Python for everything except things that need to be ridiculously optimized for speed. Thats what C embedded in Python and Psyco enhanced Python code is for. Oh wait, thats still all Python... -- http://mail.python.org/mailman/listinfo/python-list

Re: When someone from Britain speaks, Americans hear a "British accent"...

2005-06-30 Thread James Stroud
Well--to take this as far OT as imaginable, yes I do have strange hearing problems. I have difficulty recognizing speech of any kind with my right ear. Amazing to think that this would be enhanced for British, but it would be consistent with my experience, which seems similar to yours. James O

Re: saving pre-compiled scripts

2005-06-30 Thread Derek van Vliet
I probably should have also mentioned that my application is written in C++ and using the Python/C API. -- http://mail.python.org/mailman/listinfo/python-list

Python for everything?

2005-06-30 Thread xeys_00
I posted a article earlier pertaining programming for my boss. Now I am gonna ask a question about programming for myself. I just finished my first C++ Class. Next semester is a class on encryption(and it's probably gonna be a math class too). And finally back in programming in the fall with C++ an

class attribute to instance attribute

2005-06-30 Thread Donnal Walter
This is a question about Python patterns or idioms. Over a period of time, I have evolved a pattern of usage that seems to work better for me than other ways I tried previously, but in writing some documentation I don't know what to call this syntax or how best to describe it. I have not seen i

Re: When someone from Britain speaks, Americans hear a "British accent"...

2005-06-30 Thread Bill
James Stroud wrote: > Frankly, I can't watch Shakespeare or movies like "the full monty" or > "trainspotting" because I can't understand a damn word they say. British talk > sounds like gibberish to me for the most part. Have you had your hearing checked recently? Seriously. I have a hearing defec

Re: Seeking IDE

2005-06-30 Thread Bruno Desthuilliers
Nick Mountford a écrit : > Hi, > > Complete newb to Python and programming, looking for an open source > IDE to download. Any suggestions? Use something simple. Start with Idle (it comes with Python, and has all the basic features you may need to learn Python). When you'll have learn the bases,

Re: Controlling WinAMP (WM_COPYDATA problem)

2005-06-30 Thread The Collector
Hi, i changed the code to this: -- from win32gui import FindWindow from win32api import SendMessage import struct import array hWnd = FindWindow('Winamp v1.x', None) def packData( dwData, item ): global cds, lpData lpData = array.array('c', item) lpData

Re: saving pre-compiled scripts

2005-06-30 Thread Derek van Vliet
Another thing which may be important to note re: my constraints is that each script is essentially being run as a function. In fact, every script element I parse in XML gets wrapped in a function def before I send it to Py_CompileString. I then PyEval the result of that function, and then run Py_

doc 2 pdf

2005-06-30 Thread Alberto Vera
Hello. I tried to use reportlab to convert a doc to pdf file, but i didn't found any script to do this using python.   Do you have any script to convert a doc file? (doc->pdf)   Regards -- http://mail.python.org/mailman/listinfo/python-list

Re: Scket connection to server

2005-06-30 Thread André Egners
Steve Horsley wrote: > JudgeDread wrote: > >> hello python gurus >> >> I would like to establish a socket connection to a server running a >> service >> on port 2. the host address is 10.214.109.50. how do i do this using >> python? >> >> many thanks >> >> > > Off the top of my head (so there

Re: Controlling WinAMP (WM_COPYDATA problem)

2005-06-30 Thread Thomas Heller
"The Collector" <[EMAIL PROTECTED]> writes: > Hi, > > I've been looking for almost two full days now to get full control of > WinAMP using python. Simple play/stop functions are no problem. It's > the WM_COPYDATA that's used by IPC_PLAYFILE (=add a file to the > playlist) that's giving me troubles

Re: Life of Python

2005-06-30 Thread ABO
> Okay. This makes sense if the software is: > > 1) Designed by one institution. > 2) Designed almost entirely before deployment. > 3) Not designed to be worked on by users and > semi-trained developers. > > In other words --- proprietary software. In my experience, it doesn't work well even i

Re: python commmand line params from c++

2005-06-30 Thread Wesley Henwood
Thanks Denis. PySys_SetArgv should do the trick. The nested function calls are there because the FILE structrure produced by fopen is not always compatible with the FILE structure produced by the Python C++ functions. Something do with the Python C being built with different version ofthe c run-

saving pre-compiled scripts

2005-06-30 Thread Derek van Vliet
Hi, I'm working on an application that reads python scripts from XML elements and compiles them during my app's startup process using. The application then runs the resulting compiled PyCodeObjects using PyEval_EvalCode as they are needed. Now I'm wondering if its possible to pre-compile the scri

  1   2   3   >