Re: Why does os.stat() tell me that my file-group has no members?

2012-12-19 Thread Kushal Kumaran
saqib.ali...@gmail.com writes: > Thanks!! This was very helpful. It worked perfectly. > I had no clue about the intricacies of how python represents the group data > from the underlying OS. > > This page doesn't go into to detailed explanation like you did: > http://docs.python.org/2/library/grp

Determining if any threads are waiting for GIL

2012-12-19 Thread Rouslan Korneychuk
I'm working on a package that can compile CPython byte-code into native machine code (so far: x86 and x86_64 are supported). I have support for almost every byte-code instruction implemented already, but to fully emulate the interpreter, I need an efficient way to determine two things: when to

Re: Py 3.3, unicode / upper()

2012-12-19 Thread Steven D'Aprano
On Thu, 20 Dec 2012 00:32:42 -0500, Terry Reedy wrote: > In the unicode case, Jim discovered that find was several times slower > in 3.3 than 3.2 and claimed that that was a reason to not use 3.2. I ran > the complete stringbency.py and discovered that find (and consequently > find and replace) ar

Re: Py 3.3, unicode / upper()

2012-12-19 Thread Terry Reedy
On 12/19/2012 10:12 PM, Westley Martínez wrote: On Wed, Dec 19, 2012 at 09:54:20PM -0500, Terry Reedy wrote: On 12/19/2012 9:03 PM, Chris Angelico wrote: On Thu, Dec 20, 2012 at 5:27 AM, Ian Kelly wrote: From what I've been able to discern, [jmf's] actual complaint about PEP 393 stems from m

Re: Py 3.3, unicode / upper()

2012-12-19 Thread Chris Angelico
On Thu, Dec 20, 2012 at 2:12 PM, Westley Martínez wrote: > Really, why should we be so obsessed with speed anyways? Isn't > improving the language and fixing bugs far more important? Because speed is very important in certain areas. Python can be used in many ways: * Command-line calculator wit

Re: Py 3.3, unicode / upper()

2012-12-19 Thread Westley Martínez
On Wed, Dec 19, 2012 at 09:54:20PM -0500, Terry Reedy wrote: > On 12/19/2012 9:03 PM, Chris Angelico wrote: > >On Thu, Dec 20, 2012 at 5:27 AM, Ian Kelly wrote: > >> From what I've been able to discern, [jmf's] actual complaint about PEP > >>393 stems from misguided moral concerns. With PEP-393,

Re: Py 3.3, unicode / upper()

2012-12-19 Thread Terry Reedy
On 12/19/2012 9:03 PM, Chris Angelico wrote: On Thu, Dec 20, 2012 at 5:27 AM, Ian Kelly wrote: From what I've been able to discern, [jmf's] actual complaint about PEP 393 stems from misguided moral concerns. With PEP-393, strings that can be fully represented in Latin-1 can be stored in half

Re: Py 3.3, unicode / upper()

2012-12-19 Thread Westley Martínez
On Wed, Dec 19, 2012 at 02:23:15PM -0700, Ian Kelly wrote: > On Wed, Dec 19, 2012 at 1:55 PM, wrote: > > If "wrong", this can be considered as programmatically correct > > or logically acceptable (Py3.2) > > > 'Straße'.upper().lower().capitalize() == 'Straße' > > True > > > > while this wil

Re: Brython - Python in the browser

2012-12-19 Thread Terry Reedy
On 12/19/2012 7:54 PM, Ian Kelly wrote: On Wed, Dec 19, 2012 at 5:07 PM, Terry Reedy wrote: That says that my browser, Firefox 17, does not support HTML5. Golly gee. I don't think any browser support5 all of that moving target, and Gecko apparently supports about as large a subset as most. http

Re: Why does os.stat() tell me that my file-group has no members?

2012-12-19 Thread Chris Angelico
On Thu, Dec 20, 2012 at 12:23 PM, wrote: > > Thanks!! This was very helpful. It worked perfectly. > I had no clue about the intricacies of how python represents the group data > from the underlying OS. > > This page doesn't go into to detailed explanation like you did: > http://docs.python.org/

Re: Py 3.3, unicode / upper()

2012-12-19 Thread Chris Angelico
On Thu, Dec 20, 2012 at 5:27 AM, Ian Kelly wrote: > From what I've been able to discern, [jmf's] actual complaint about PEP > 393 stems from misguided moral concerns. With PEP-393, strings that > can be fully represented in Latin-1 can be stored in half the space > (ignoring fixed overhead) compa

Re: Py 3.3, unicode / upper()

2012-12-19 Thread Chris Angelico
On Thu, Dec 20, 2012 at 8:23 AM, Ian Kelly wrote: > On Wed, Dec 19, 2012 at 1:55 PM, wrote: >> Yes, it is correct (or can be considered as correct). >> I do not wish to discuss the typographical problematic >> of "Das Grosse Eszett". The web is full of pages on the >> subject. However, I never s

Re: Why does os.stat() tell me that my file-group has no members?

2012-12-19 Thread saqib . ali . 75
Thanks!! This was very helpful. It worked perfectly. I had no clue about the intricacies of how python represents the group data from the underlying OS. This page doesn't go into to detailed explanation like you did: http://docs.python.org/2/library/grp.html On Wednesday, December 19, 2012 6

Re: Brython - Python in the browser

2012-12-19 Thread Ian Kelly
On Wed, Dec 19, 2012 at 5:07 PM, Terry Reedy wrote: > That says that my browser, Firefox 17, does not support HTML5. Golly gee. I > don't think any browser support5 all of that moving target, and Gecko > apparently supports about as large a subset as most. > https://en.wikipedia.org/wiki/Compariso

Re: Py 3.3, unicode / upper()

2012-12-19 Thread Terry Reedy
On 12/19/2012 10:40 AM, Chris Angelico wrote: Interestingly, IDLE on my Windows box can't handle the bolded characters very well... s="\U0001d407\U0001d41e\U0001d425\U0001d425\U0001d428, \U0001d430\U0001d428\U0001d42b\U0001d425\U0001d41d!" print(s) Traceback (most recent call last): File

Re: context aware execution

2012-12-19 Thread Michael Torrie
On 12/19/2012 09:51 AM, Bart Thate wrote: > Think of sending JSON over the wire, reconstruct an object with it and then > let the object figure out what it can and cannot do in this external > environment. Probably the better way to do it is to formally define an API that lets an object discover t

Re: Fuzzy Logic Library for Python 3

2012-12-19 Thread Terry Reedy
On 12/19/2012 9:22 AM, Alexsandro Soares wrote: Hi all, I'm trying to build an fuzzy expert system in Python 3 and I need a good recommendation for a library/package for this, but working in Python 3.2. Some options are pyfuzzy and pyfuzzylib, Please tell the authors that you would like to

Re: calculation on lists

2012-12-19 Thread Chris Kaynor
On Wed, Dec 19, 2012 at 4:38 AM, Vlastimil Brom wrote: > 2012/12/19 loïc Lauréote : > hi, > I > have a question, > is there a tool to calculate on list ? > > something like : > > >a= [1,1,1,1] > >b = [5,9,8,4] > >c = a+b*a > >print c > >[6,10,9,5] > > Thx > > == > > Hi, > for such simpler cas

Re: Brython - Python in the browser

2012-12-19 Thread Terry Reedy
On 12/19/2012 1:19 PM, Pierre Quentel wrote: The objective of Brython is to replace Javascript by Python as the scripting language for web browsers, making it usable on all terminals including smartphones, tablets, connected TVs, etc. Please forgive the lack of ambition ;-) This sounds similar

Re: Why does os.stat() tell me that my file-group has no members?

2012-12-19 Thread Hans Mulder
On 19/12/12 22:40:00, saqib.ali...@gmail.com wrote: > > > I'm using python 2.6.4 on Solaris 5-10. > > I have a file named "myFile". It is owned by someone else, by > I ("myuser") am in the file's group ("mygrp"). Below is my python > code. Why does it tell me that mygrp has no members??? > > >

Re: Brython - Python in the browser

2012-12-19 Thread jkn
Hi Pierre this looks very interesting, thanks. But I wonder ... do you know of pyjs (pyjamas as-was)? http://pyjs.org/ I would be interested in a comparison between (the aims of) Brython and pyjs. Either way, thanks for the info. Regards Jon N -- http://mail.python.org/mailman/list

Re: calculation on lists

2012-12-19 Thread Chris Kaynor
Chris On Wed, Dec 19, 2012 at 7:24 AM, loïc Lauréote wrote: > Thank for your answer, > > I found something allowing to avoid loops. > I use operator overloading. > > > import math > > class Vector: > def __init__(self, x=0, y=0): > self.x=x > self.y=y > def __eq__(self,

Why does os.stat() tell me that my file-group has no members?

2012-12-19 Thread saqib . ali . 75
I'm using python 2.6.4 on Solaris 5-10. I have a file named "myFile". It is owned by someone else, by I ("myuser") am in the file's group ("mygrp"). Below is my python code. Why does it tell me that mygrp has no members??? >>> import os, pwd, grp >>> stat_info = os.stat("myFile") >>> fileUID

Re: Py 3.3, unicode / upper()

2012-12-19 Thread Ian Kelly
On Wed, Dec 19, 2012 at 2:18 PM, wrote: > latin-1 (iso-8859-1) ? are you sure ? Yes. sys.getsizeof('a') > 26 sys.getsizeof('ab') > 27 sys.getsizeof('aé') > 39 Compare to: >>> sys.getsizeof('a\u0100') 42 The reason for the difference you posted is that pure ASCII strings have a

Re: Py 3.3, unicode / upper()

2012-12-19 Thread Ian Kelly
On Wed, Dec 19, 2012 at 1:55 PM, wrote: > Yes, it is correct (or can be considered as correct). > I do not wish to discuss the typographical problematic > of "Das Grosse Eszett". The web is full of pages on the > subject. However, I never succeeded to find an "official > position" from Unicode. T

Re: Py 3.3, unicode / upper()

2012-12-19 Thread wxjmfauth
Le mercredi 19 décembre 2012 19:27:38 UTC+1, Ian a écrit : > On Wed, Dec 19, 2012 at 8:40 AM, Chris Angelico wrote: > > > You may not be familiar with jmf. He's one of our resident trolls, and > > > he has a bee in his bonnet about PEP 393 strings, on the basis that > > > they take up more spac

Re: Py 3.3, unicode / upper()

2012-12-19 Thread wxjmfauth
Le mercredi 19 décembre 2012 15:52:23 UTC+1, Christian Heimes a écrit : > Am 19.12.2012 15:23, schrieb wxjmfa...@gmail.com: > > > But, this is not the problem. > > > I was suprised to discover this: > > > > > 'Straße'.upper() > > > 'STRASSE' > > > > > > I really, really do not know wh

Re: plotting pairs of data

2012-12-19 Thread hugocoolens
On 19 dec, 15:38, Thomas Bach wrote: > On Wed, Dec 19, 2012 at 05:47:30AM -0800,hugocoolenswrote: > > The data is available in Python in this format: > > ['0.0364771 0.55569', '0.132688 0.808496', '0.232877 0.832833', > > '0.332702 0.849128', '0.432695 0.862158'] > > > I suppose it is possible to

Re: Fuzzy Logic Library for Python 3

2012-12-19 Thread Grant Rettke
I also pondered this, though not intensely or urgently. I felt like Jython and Jess with FuzzyJess might be interesting http://www.jessrules.com/FAQ.shtml#Q13 though I didn't dig any further. On Wed, Dec 19, 2012 at 8:22 AM, Alexsandro Soares wrote: > Hi all, > >I'm trying to build an fuzz

Re: Py 3.3, unicode / upper()

2012-12-19 Thread Benjamin Peterson
gmail.com> writes: > I really, really do not know what I should think about that. > (It is a complex subject.) And the real question is why? Because that's what the Unicode spec says to do. -- http://mail.python.org/mailman/listinfo/python-list

Re: Virtualenv loses context

2012-12-19 Thread rhythmicdevil
Thanks for the information Hans, I will double check that stuff. I am positive however that the environment was active. In addition that fact that I get different responses from python -m site from the botnet_etl virtual environment before I blew it away and after I rebuilt it really concerns me

Re: Virtualenv loses context

2012-12-19 Thread Hans Mulder
On 19/12/12 15:38:01, rhythmicde...@gmail.com wrote: > Just installed a brand new virtualenv along with two packages. Ran this and I > got nothing: > > (venvtest)[swright@localhost venvtest]$ python -m site > (venvtest)[swright@localhost venvtest]$ > > I expected to have at least one path in sys

Re: Problem with Threads

2012-12-19 Thread Hans Mulder
On 19/12/12 18:11:37, Kwnstantinos Euaggelidis wrote: > I have this code for Prime Numbers and i want to do it with Threads.. > Any idea.?? Why would you want to do that? It's not going to be any faster, since your code is CPU-bound. You may have several CPUs, but CPython is going to use only one

Re: Problem with Threads

2012-12-19 Thread Dave Angel
On 12/19/2012 12:11 PM, Kwnstantinos Euaggelidis wrote: > I have this code for Prime Numbers and i want to do it with Threads.. Any > idea.?? Why do you want to do it with threads? Is it to speed up the processing? (Guessing that partly because of your printing "elapsed time." Chances are runni

Re: Py 3.3, unicode / upper()

2012-12-19 Thread Ian Kelly
On Wed, Dec 19, 2012 at 8:40 AM, Chris Angelico wrote: > You may not be familiar with jmf. He's one of our resident trolls, and > he has a bee in his bonnet about PEP 393 strings, on the basis that > they take up more space in memory than a narrow build of Python 3.2 > would, for a string with lot

Re: calculation on lists

2012-12-19 Thread Tim Chase
On 12/19/12 09:24, loïc Lauréote wrote: >> is there a tool to calculate on list ? >> >> something like : >> >>> a= [1,1,1,1] >>> b = [5,9,8,4] >>> c = a+b*a >>> print c >>> [6,10,9,5] >> >> Thx >> >> == >> >> Hi, >> for such simpler cases, you may try list comprehensions and probably >> the zi

Brython - Python in the browser

2012-12-19 Thread Pierre Quentel
Hi, The objective of Brython is to replace Javascript by Python as the scripting language for web browsers, making it usable on all terminals including smartphones, tablets, connected TVs, etc. Please forgive the lack of ambition ;-) The best introduction is to visit the Brython site (http://w

Re: calculation on lists

2012-12-19 Thread Vlastimil Brom
2012/12/19 loïc Lauréote : > hi, > I > have a question, > is there a tool to calculate on list ? > > something like : > >>a= [1,1,1,1] >>b = [5,9,8,4] >>c = a+b*a >>print c >>[6,10,9,5] > > Thx > > -- > http://mail.python.org/mailman/listinfo/python-list > Hi, I guess, if you are interested in ef

Re: context aware execution

2012-12-19 Thread Bart Thate
Thanks for your response Chris ! Ha ! the job of the mad man is todo the things the are not "advisable" and see what gives. Like why it is not advisable and, if possible, their are ways to achieve things that are previously overseen. i already do a lot of travelling of the callstack to see from

Problem with Threads

2012-12-19 Thread Kwnstantinos Euaggelidis
I have this code for Prime Numbers and i want to do it with Threads.. Any idea.?? # prime numbers are only divisible by unity and themselves # (1 is not considered a prime number by convention) import time def isprime(n): if n == 2: return 1 if n % 2 == 0: return 0 max

Re: context aware execution

2012-12-19 Thread Wayne Werner
On Thu, 20 Dec 2012, Chris Angelico wrote: On Thu, Dec 20, 2012 at 2:57 AM, Bart Thate wrote: I want in a function or method determine the context of my caller and adapt the functionality accordingly. First off, please don't! Your code will be *extremely* confusing. Usually, the best way to

Re: [newbie] plotting pairs of data

2012-12-19 Thread Miki Tebeka
On Wednesday, December 19, 2012 6:38:30 AM UTC-8, Thomas Bach wrote: > On Wed, Dec 19, 2012 at 05:47:30AM -0800, hugocoolens wrote: > > ['0.0364771 0.55569', '0.132688 0.808496', '0.232877 0.832833', > > '0.332702 0.849128', '0.432695 0.862158'] > xs = [ float(x) for x, _ in map(str.split, l) ] > y

Re: context aware execution

2012-12-19 Thread Chris Angelico
On Thu, Dec 20, 2012 at 2:57 AM, Bart Thate wrote: > Hi All ! > > Is is possible and if yes, is it more easily possible (i am thinking f_back > maybe) to get the context of the caller when in a function ? > > Like to which variable name is this object assigned ? > > Or whatever of the callers cont

context aware execution

2012-12-19 Thread Bart Thate
Hi All ! Is is possible and if yes, is it more easily possible (i am thinking f_back maybe) to get the context of the caller when in a function ? Like to which variable name is this object assigned ? Or whatever of the callers context that might be of interest. I want in a function or method de

Re: Py 3.3, unicode / upper()

2012-12-19 Thread Chris Angelico
On Thu, Dec 20, 2012 at 2:18 AM, Johannes Bauer wrote: > On 19.12.2012 15:23, wxjmfa...@gmail.com wrote: >> I was using the German word "Straße" (Strasse) — German >> translation from "street" — to illustrate the catastrophic and >> completely wrong-by-design Unicode handling in Py3.3, this >> tim

Re: Py 3.3, unicode / upper()

2012-12-19 Thread Christian Heimes
Am 19.12.2012 16:01, schrieb Stefan Krah: > The uppercase ß isn't really needed, since ß does not occur at the beginning > of a word. As far as I know, most Germans wouldn't even know that it has > existed at some point or how to write it. I think Python 3.3+ is using uppercase mapping (uc) instea

calculation on lists

2012-12-19 Thread loïc Lauréote
Thank for your answer, I found something allowing to avoid loops. I use operator overloading. import math class Vector: def __init__(self, x=0, y=0): self.x=x self.y=y def __eq__(self, vB): return (self.x==vB.x) and (self.y==vB.y) def __add__(self, vB): re

Re: Py 3.3, unicode / upper()

2012-12-19 Thread Johannes Bauer
On 19.12.2012 16:18, Johannes Bauer wrote: > How do those arbitrary numbers prove anything at all? Why do you draw > the conclusion that it's broken by design? What do you expect? You're > very vague here. Just to show how ridiculously pointless your numers > are, your example gives 84 on Python3.

Re: Py 3.3, unicode / upper()

2012-12-19 Thread Johannes Bauer
On 19.12.2012 15:23, wxjmfa...@gmail.com wrote: > I was using the German word "Straße" (Strasse) — German > translation from "street" — to illustrate the catastrophic and > completely wrong-by-design Unicode handling in Py3.3, this > time from a memory point of view (not speed): > sys.getsiz

Re: Py 3.3, unicode / upper()

2012-12-19 Thread Chris Angelico
On Thu, Dec 20, 2012 at 1:23 AM, wrote: > But, this is not the problem. > I was suprised to discover this: > 'Straße'.upper() > 'STRASSE' > > I really, really do not know what I should think about that. > (It is a complex subject.) And the real question is why? Not all strings can be upperc

Re: Virtualenv loses context

2012-12-19 Thread rhythmicdevil
So I reinstalled the virtualenv for my project from scratch. Application runs as expected. Here are the notes that I took while installing. Interestingly the command 'python -m site' produces no output now. Notice that before I reinstalled the virtualenv I got a bunch of paths from that command.

Re: Py 3.3, unicode / upper()

2012-12-19 Thread Stefan Krah
wxjmfa...@gmail.com wrote: > But, this is not the problem. > I was suprised to discover this: > > >>> 'Straße'.upper() > 'STRASSE' > > I really, really do not know what I should think about that. > (It is a complex subject.) And the real question is why? http://de.wikipedia.org/wiki/Gro%C3%9Fes

Re: Telnetlib and special quit characters with Ctrl, oh my!

2012-12-19 Thread Chris Angelico
On Thu, Dec 20, 2012 at 1:28 AM, wrote: > I am using telnetlib and the box that I'm connecting to has a special escape > sequence--^]--to leave the prompt and go back to the regular telnet prompt. > For example, from teh command line I do this: > ... > When I pressing and hold Ctrl and then ],

Re: Py 3.3, unicode / upper()

2012-12-19 Thread Christian Heimes
Am 19.12.2012 15:23, schrieb wxjmfa...@gmail.com: > But, this is not the problem. > I was suprised to discover this: > 'Straße'.upper() > 'STRASSE' > > I really, really do not know what I should think about that. > (It is a complex subject.) And the real question is why? It's correct. LATIN

Re: Virtualenv loses context

2012-12-19 Thread rhythmicdevil
Just installed a brand new virtualenv along with two packages. Ran this and I got nothing: (venvtest)[swright@localhost venvtest]$ python -m site (venvtest)[swright@localhost venvtest]$ I expected to have at least one path in sys.path [swright@localhost workspace]$ virtualenv --no-site-pa

Re: [newbie] plotting pairs of data

2012-12-19 Thread Thomas Bach
On Wed, Dec 19, 2012 at 05:47:30AM -0800, hugocoolens wrote: > The data is available in Python in this format: > ['0.0364771 0.55569', '0.132688 0.808496', '0.232877 0.832833', > '0.332702 0.849128', '0.432695 0.862158'] > > I suppose it is possible to plot x versus y using matplotlib, maybe > sep

Re: Py 3.3, unicode / upper()

2012-12-19 Thread Thomas Bach
On Wed, Dec 19, 2012 at 06:23:00AM -0800, wxjmfa...@gmail.com wrote: > I was suprised to discover this: > > >>> 'Straße'.upper() > 'STRASSE' > > I really, really do not know what I should think about that. > (It is a complex subject.) And the real question is why? Because there is no definition

Re: Virtualenv loses context

2012-12-19 Thread rhythmicdevil
This may have something to do with it. I create the virtualenv in: /home/swright/workspace/botnet_etl/ After I install my app the directory structure looks like this: (botnet_etl)[swright@localhost botnet_etl]$ ll total 32 drwxrwxr-x 4 swright swright 4096 Dec 19 09:21 app drwxrwxr-x 3 swrig

Telnetlib and special quit characters with Ctrl, oh my!

2012-12-19 Thread winona_whitener
Greetings all, I am using telnetlib and the box that I'm connecting to has a special escape sequence--^]--to leave the prompt and go back to the regular telnet prompt. For example, from teh command line I do this: telnet 123.12.123.0 Login:> xx Password:> xxx Welcome. Connected to '12

Re: Virtualenv loses context

2012-12-19 Thread rhythmicdevil
I wrote this little test script to prove my virtualenv is reading from global site packages: Script Content from distutils.sysconfig import get_python_lib print (get_python_lib()) Script Output (botnet_etl)[swright@localhost app]$ python test.py /usr/lib/python2.6/site-packages (botnet_etl)[swr

Re: Virtualenv loses context

2012-12-19 Thread rhythmicdevil
This may have something to do with it. I create the virtualenv in: /home/swright/workspace/botnet_etl/ After I install my app the directory structure looks like this: (botnet_etl)[swright@localhost botnet_etl]$ ll total 32 drwxrwxr-x 4 swright swright 4096 Dec 19 09:21 app drwxrwxr-x 3 swright swr

Py 3.3, unicode / upper()

2012-12-19 Thread wxjmfauth
I was using the German word "Straße" (Strasse) — German translation from "street" — to illustrate the catastrophic and completely wrong-by-design Unicode handling in Py3.3, this time from a memory point of view (not speed): >>> sys.getsizeof('Straße') 43 >>> sys.getsizeof('STRAẞE') 50 instead of

Re: Pattern-match & Replace - help required

2012-12-19 Thread MRAB
On 2012-12-19 14:11, Alexander Blinne wrote: Am 19.12.2012 14:41, schrieb AT: Thanks a million Can you recommend a good online book/tutorial on regular expr. in python? http://docs.python.org/3/howto/regex.html Another good resource is: http://www.regular-expressions.info/ -- http://mail.p

Fuzzy Logic Library for Python 3

2012-12-19 Thread Alexsandro Soares
Hi all, I'm trying to build an fuzzy expert system in Python 3 and I need a good recommendation for a library/package for this, but working in Python 3.2. Some options are pyfuzzy and pyfuzzylib, but I was not succeed to install these packages with Python 3. Thanks in advance for any answer

Virtualenv loses context

2012-12-19 Thread rhythmicdevil
I am somewhat new to Python and virtualenv. I have setup a virtualenv with no site packages under the assumption that all 3rd party packages will be installed into the site-packages directory for the virtualenv. Another assumption I have about virtualenv is that it's completely self contained.

Re: Pattern-match & Replace - help required

2012-12-19 Thread Alexander Blinne
Am 19.12.2012 14:41, schrieb AT: > Thanks a million > Can you recommend a good online book/tutorial on regular expr. in python? http://docs.python.org/3/howto/regex.html -- http://mail.python.org/mailman/listinfo/python-list

[newbie] plotting pairs of data

2012-12-19 Thread hugocoolens
I have a data set for which x and y-values are presented as pairs of floating point numbers: e.g. 0.0364771 0.55569 is the first pair . 0.132688 0.808496 is the second pair . . The data is available in Python in this format: ['0.0364771 0.55569', '0.132688 0.808496', '0.232877 0.832833', '0.33

Re: Pattern-match & Replace - help required

2012-12-19 Thread AT
On Wednesday, 19 December 2012 18:16:18 UTC+5, Peter Otten wrote: > AT wrote: > > > > > I am new to python and web2py framework. Need urgent help to match a > > > pattern in an string and replace the matched text. > > > > > > I've this string (basically an sql statement): > > > stmnt = 'SE

Re: Why Doesn't This MySQL Statement Execute?

2012-12-19 Thread Alister
On Tue, 18 Dec 2012 17:34:08 -0400, Tom Borkin wrote: > Hi; > I have this test code: > > if i_id == "1186": > sql = 'insert into interactions values(Null, %s, "Call Back","% s")' % (i_id, date_plus_2) > cursor.execute(sql) Please don't build your sql strings like this but pass th

Re: Pattern-match & Replace - help required

2012-12-19 Thread Peter Otten
AT wrote: > I am new to python and web2py framework. Need urgent help to match a > pattern in an string and replace the matched text. > > I've this string (basically an sql statement): > stmnt = 'SELECT taxpayer.id, > taxpayer.enc_name, > taxpayer.age, > taxpayer.occup

Re: calculation on lists

2012-12-19 Thread Vlastimil Brom
2012/12/19 loïc Lauréote : hi, I have a question, is there a tool to calculate on list ? something like : >a= [1,1,1,1] >b = [5,9,8,4] >c = a+b*a >print c >[6,10,9,5] Thx == Hi, for such simpler cases, you may try list comprehensions and probably the zip(...) function >>> [a+b*a for a,b

calculation on lists

2012-12-19 Thread loïc Lauréote
hi, I have a question, is there a tool to calculate on list ? something like : >a= [1,1,1,1] >b = [5,9,8,4] >c = a+b*a >print c >[6,10,9,5] Thx -- http://mail.python.org/mailman/listinfo/python-list

Re: Pattern-match & Replace - help required

2012-12-19 Thread AT
On Wednesday, 19 December 2012 16:27:19 UTC+5, Thomas Bach wrote: > On Wed, Dec 19, 2012 at 02:42:26AM -0800, AT wrote: > > > Hi, > > > > > > I am new to python and web2py framework. Need urgent help to match a > > > pattern in an string and replace the matched text. > > > > > > > Well,

YOU CAN EARN $200 Day.

2012-12-19 Thread freejobonline1
PART TIME JOBS You can join get free for $10 http://www.profitclicking.com/?r=J6pLs7V4sU Simple Work,No Experience Necessary, Excellent Rates of Pay,STEP by STEP INTRODUTION, http://www.profitclicking.com/?r=J6pLs7V4sU -- http://mail.python.org/mailman/listinfo/python-list

Re: counting how often the same word appears in a txt file...But my code only prints the last line entry in the txt file

2012-12-19 Thread dgcosgrave
On Thursday, December 20, 2012 12:21:57 AM UTC+13, Thomas Bach wrote: > Hi, > > > > just as a side-note > > > > On Wed, Dec 19, 2012 at 02:45:13AM -0800, : > > > for word in list: > > > if word in dict: > > > count = dict[word] > > >

Re: counting how often the same word appears in a txt file...But my code only prints the last line entry in the txt file

2012-12-19 Thread dgcosgrave
On Thursday, December 20, 2012 12:03:21 AM UTC+13, Steven D'Aprano wrote: > On Wed, 19 Dec 2012 02:45:13 -0800, dgcosgrave wrote: > > > > > Hi Iam just starting out with python...My code below changes the txt > > > file into a list and add them to an empty dictionary and print how often > > >

Re: counting how often the same word appears in a txt file...But my code only prints the last line entry in the txt file

2012-12-19 Thread dgcosgrave
On Wednesday, December 19, 2012 11:55:28 PM UTC+13, Jussi Piitulainen wrote: > > > > > > Hi Iam just starting out with python...My code below changes the txt > > > file into a list and add them to an empty dictionary and print how > > > often the word occurs, but it only seems to recognise an

Re: Pattern-match & Replace - help required

2012-12-19 Thread Thomas Bach
On Wed, Dec 19, 2012 at 02:42:26AM -0800, AT wrote: > Hi, > > I am new to python and web2py framework. Need urgent help to match a > pattern in an string and replace the matched text. > Well, what about str.replace then? >>> 'egg, ham, tomato'.replace('ham', 'spam, ham, spam') 'egg, spam, ham,

Re: counting how often the same word appears in a txt file...But my code only prints the last line entry in the txt file

2012-12-19 Thread Thomas Bach
Hi, just as a side-note On Wed, Dec 19, 2012 at 02:45:13AM -0800, dgcosgr...@gmail.com wrote: > for word in list: > if word in dict: > count = dict[word] > count += 1 > dict[word] = count > else: > dict[wor

Re: Pattern-match & Replace - help required

2012-12-19 Thread Steven D'Aprano
On Wed, 19 Dec 2012 03:01:32 -0800, AT wrote: > I just wanted to change taxpayer.enc_name in stmnt to > decrypt(taxpayer.enc_name) > > hope it clarifies? Maybe. Does this help? lunch = "Bread, ham, cheese and tomato." # replace ham with spam offset = lunch.find('ham') if offset != -1: lunch

Re: Pattern-match & Replace - help required

2012-12-19 Thread AT
On Wednesday, 19 December 2012 15:51:22 UTC+5, Steven D'Aprano wrote: > On Wed, 19 Dec 2012 02:42:26 -0800, AT wrote: > > > > > Hi, > > > > > > I am new to python and web2py framework. Need urgent help to match a > > > pattern in an string and replace the matched text. > > > > > > I've

Re: counting how often the same word appears in a txt file...But my code only prints the last line entry in the txt file

2012-12-19 Thread Steven D'Aprano
On Wed, 19 Dec 2012 02:45:13 -0800, dgcosgrave wrote: > Hi Iam just starting out with python...My code below changes the txt > file into a list and add them to an empty dictionary and print how often > the word occurs, but it only seems to recognise and print the last entry > of the txt file. Any

Re: counting how often the same word appears in a txt file...But my code only prints the last line entry in the txt file

2012-12-19 Thread Jussi Piitulainen
dgcosgr...@gmail.com writes: > Hi Iam just starting out with python...My code below changes the txt > file into a list and add them to an empty dictionary and print how > often the word occurs, but it only seems to recognise and print the > last entry of the txt file. Any help would be great. > >

Re: Pattern-match & Replace - help required

2012-12-19 Thread Steven D'Aprano
On Wed, 19 Dec 2012 02:42:26 -0800, AT wrote: > Hi, > > I am new to python and web2py framework. Need urgent help to match a > pattern in an string and replace the matched text. > > I've this string (basically an sql statement): > > stmnt = 'SELECT taxpayer.id, > taxpayer.enc_name, >

counting how often the same word appears in a txt file...But my code only prints the last line entry in the txt file

2012-12-19 Thread dgcosgrave
Hi Iam just starting out with python...My code below changes the txt file into a list and add them to an empty dictionary and print how often the word occurs, but it only seems to recognise and print the last entry of the txt file. Any help would be great. tm =open('ask.txt', 'r') dict = {} for

Pattern-match & Replace - help required

2012-12-19 Thread AT
Hi, I am new to python and web2py framework. Need urgent help to match a pattern in an string and replace the matched text. I've this string (basically an sql statement): stmnt = 'SELECT taxpayer.id, taxpayer.enc_name, taxpayer.age, taxpayer.occupation FROM