Re: father class name

2012-12-30 Thread Chris Rebert
On Sun, Dec 30, 2012 at 8:18 PM, contro opinion wrote: > here is my haha class > class haha(object): > def theprint(self): > print "i am here" > haha().theprint() > i am here haha(object).theprint() > Traceback (most recent call last): > File "", line 1, in > TypeError: objec

Re: class problem

2012-12-30 Thread Chris Rebert
On Sun, Dec 30, 2012 at 10:36 PM, contro opinion wrote: > here is my haha class > class haha(object): > def theprint(self): > print "i am here" > haha().theprint() > i am here haha(object).theprint() > Traceback (most recent call last): > File "", line 1, in > TypeError: obje

Re: class problem

2012-12-30 Thread Dave Angel
On 12/31/2012 01:36 AM, contro opinion wrote: > here is my haha class You posted the same question twice before, and it was answered two hours ago. Read the first thread, instead of starting spurious ones. -- DaveA -- http://mail.python.org/mailman/listinfo/python-list

Re: how to get the source of html in lxml?

2012-12-30 Thread Dave Angel
On 12/31/2012 01:32 AM, contro opinion wrote: > import urllibimport lxml.html > down='http://blog.sina.com.cn/s/blog_71f3890901017hof.html' > file=urllib.urlopen(down).read() > root=lxml.html.document_fromstring(file) > body=root.xpath('//div[@class="articalContent "]')[0]print > body.text_conten

Re: how to get the source of html in lxml?

2012-12-30 Thread Chris Rebert
On Sun, Dec 30, 2012 at 10:32 PM, contro opinion wrote: > import urllib > import lxml.html > down='http://blog.sina.com.cn/s/blog_71f3890901017hof.html' > file=urllib.urlopen(down).read() > root=lxml.html.document_fromstring(file) > body=root.xpath('//div[@class="articalContent "]')[0] > print bo

Re: father class name

2012-12-30 Thread Andrew Berg
On 2012.12.30 22:18, contro opinion wrote: > here is my haha class > class haha(object): > def theprint(self): > print "i am here" > haha().theprint() > i am here haha(object).theprint() > Traceback (most recent call last): > File "", line 1, in > TypeError: object.__new__()

Re: father class name

2012-12-30 Thread Roy Smith
In article , contro opinion wrote: > here is my haha class > class haha(object): > def theprint(self): > print "i am here" > > >>> haha().theprint() > i am here > >>> haha(object).theprint() > Traceback (most recent call last): > File "", line 1, in > TypeError: object.__new__() tak

father class name

2012-12-30 Thread contro opinion
here is my haha class class haha(object): def theprint(self): print "i am here" >>> haha().theprint() i am here >>> haha(object).theprint() Traceback (most recent call last): File "", line 1, in TypeError: object.__new__() takes no parameters why haha(object).theprint() get wrong o

Re: Python 3.3, gettext and Unicode problems

2012-12-30 Thread Marcel Rodrigues
Thank you Terry! I was trying to follow the documentation but somehow didn't payed attention to the lgettext/gettext distinction until I read your first response. Changing lgettext to gettext solved the problem. It prints correctly to my console because I have to environmental variable PYTHONIOEN

Re: Python 3.3, gettext and Unicode problems

2012-12-30 Thread Terry Reedy
On 12/30/2012 8:48 PM, Terry Reedy wrote: On 12/30/2012 7:39 PM, Marcel Rodrigues wrote: I'm using Python 3.3 (CPython) and am having trouble getting the standard gettext module to handle Unicode messages. Addition to previous response. import gettext t = gettext.translation("greeting", "lo

Re: Python 3.3, gettext and Unicode problems

2012-12-30 Thread Terry Reedy
On 12/30/2012 7:39 PM, Marcel Rodrigues wrote: I'm using Python 3.3 (CPython) and am having trouble getting the standard gettext module to handle Unicode messages. I have never even looked at the doc before, but I will take a look. My problem can be isolated as follows: I have 3 files in a f

Python 3.3, gettext and Unicode problems

2012-12-30 Thread Marcel Rodrigues
I'm using Python 3.3 (CPython) and am having trouble getting the standard gettext module to handle Unicode messages. My problem can be isolated as follows: I have 3 files in a folder: greeting.py, greeting.po and msgfmt.py. -- greeting.py -- import gettext t = gettext.translation("greeting", "lo

Re: ignore case only for a part of the regex?

2012-12-30 Thread Cameron Simpson
On 30Dec2012 12:32, Roy Smith wrote: | In article , | Vlastimil Brom wrote: | > you may check the new regex implementation for python | > http://pypi.python.org/pypi/regex [...] | I'm not sure I like the fuzzy matching stuff. On the one hand, it can | be useful. On the other hand, people alre

Re: Beginner: Trying to get REAL NUMBERS from %d command

2012-12-30 Thread Alvaro Lacerda
%s got the job done!!! Thank you all for the info and links, I appreciate it! -- http://mail.python.org/mailman/listinfo/python-list

Re: Python lists

2012-12-30 Thread Hans Mulder
On 30/12/12 23:25:39, Evan Driscoll wrote: > On 12/30/2012 4:19 PM, Hans Mulder wrote: >> If it's okay to modify the original list, you can simply do: >> >> l[0] = split(l[0], ", ") >> >> If modifying the original is not okay, the simple solution would >> be to copy it first: >> >> l2 = l >> l2[0]

Re: Beginner: Trying to get REAL NUMBERS from %d command

2012-12-30 Thread Hans Mulder
Hello, Python does not support REAL numbers. It has float number, which are approximations of real numbers. They behave almost, but not quite, like you might expect. It also has Decimal numbers. They also approximate real numbers, but slightly differently. They might behave more like you'd ex

Re: Beginner: Trying to get REAL NUMBERS from %d command

2012-12-30 Thread Peter Otten
Alvaro Lacerda wrote: > The code I wrote is supposed to ask the user to enter a number; > Then tell the user what's going to happen to that number (x / 2 + 5) ; > Then give the user an answer; > > I succeeded getting results from even numbers, but when I try diving an > uneven number (i.e. 5) by

Re: Beginner: Trying to get REAL NUMBERS from %d command

2012-12-30 Thread Vlastimil Brom
2012/12/30 Alvaro Lacerda : > The code I wrote is supposed to ask the user to enter a number; > Then tell the user what's going to happen to that number (x / 2 + 5) ; > Then give the user an answer; > > I succeeded getting results from even numbers, but when I try diving an > uneven number (i.e. 5

Re: Beginner: Trying to get REAL NUMBERS from %d command

2012-12-30 Thread Irmen de Jong
On 30-12-2012 23:37, Alvaro Lacerda wrote: > > I'm trying to get full number result using the %d command Try %f instead. %d is the formatting symbol for integer numbers. See http://docs.python.org/2/library/stdtypes.html#string-formatting-operations Or have a look at what string.format() can do:

Re: Beginner: Trying to get REAL NUMBERS from %d command

2012-12-30 Thread Joel Goldstick
On Sun, Dec 30, 2012 at 5:37 PM, Alvaro Lacerda wrote: > The code I wrote is supposed to ask the user to enter a number; > Then tell the user what's going to happen to that number (x / 2 + 5) ; > Then give the user an answer; > Try x / 2.5 + 5 > > I succeeded getting results from even numbers, b

Beginner: Trying to get REAL NUMBERS from %d command

2012-12-30 Thread Alvaro Lacerda
The code I wrote is supposed to ask the user to enter a number; Then tell the user what's going to happen to that number (x / 2 + 5) ; Then give the user an answer; I succeeded getting results from even numbers, but when I try diving an uneven number (i.e. 5) by 2, I get only the whole number (i.

Re: Re: Python lists

2012-12-30 Thread Evan Driscoll
On 12/30/2012 4:19 PM, Hans Mulder wrote: > If it's okay to modify the original list, you can simply do: > > l[0] = split(l[0], ", ") > > If modifying the original is not okay, the simple solution would > be to copy it first: > > l2 = l > l2[0] = split(l2[0], ", ") Um, that doesn't copy the lis

Re: Python lists

2012-12-30 Thread Hans Mulder
On 28/12/12 18:46:45, Alex wrote: > Manatee wrote: > >> On Friday, December 28, 2012 9:14:57 AM UTC-5, Manatee wrote: >>> I read in this: >>> >>> ['C100, C117', 'X7R 0.033uF 10% 25V 0603', '0603-C_L, 0603-C_N', >>> '10', '2', '', '30', '15463-333', 'MURATA', 'GRM188R71E333KA01D', >>> 'Digi-Key',

Re: instructor's solutions manual for Understanding Analysis by Stephen Abbott

2012-12-30 Thread santoshlinkha
On Saturday, September 3, 2011 4:47:43 AM UTC+5:45, peter kalvin wrote: > I have solutions manuals to all problems and exercises in these > textbooks. To get one in an electronic format contact me at: > kalvinmanual(at)gmail(dot)com and let me know its title, author and > edition. Please this servi

Re: Tarfile and usernames

2012-12-30 Thread Hans Mulder
On 30/12/12 19:57:31, Nicholas Cole wrote: > Dear List, > > I'm hoping to use the tarfile module in the standard library to move > some files between computers. > > I can't see documented anywhere what this library does with userids and > groupids. I can't guarantee that the computers involved

Re: Tarfile and usernames

2012-12-30 Thread Nicholas Cole
On Sun, Dec 30, 2012 at 8:07 PM, Albert Hopkins wrote: > > > On Sun, Dec 30, 2012, at 01:57 PM, Nicholas Cole wrote: > > Dear List, > > I'm hoping to use the tarfile module in the standard library to move some > files between computers. > > I can't see documented anywhere what this library does wit

Re: Tarfile and usernames

2012-12-30 Thread Michael Ross
On Sun, 30 Dec 2012 19:57:31 +0100, Nicholas Cole wrote:Dear List,I'm hoping to use the tarfile module in the standard library to move some files between computers. I can't see documented anywhere what this library does with userids and groupids.  I can't guarantee that the computers involved wil

Re: Tarfile and usernames

2012-12-30 Thread Albert Hopkins
On Sun, Dec 30, 2012, at 01:57 PM, Nicholas Cole wrote: Dear List, I'm hoping to use the tarfile module in the standard library to move some files between computers. I can't see documented anywhere what this library does with userids and groupids. I can't guarantee that the computers invo

Tarfile and usernames

2012-12-30 Thread Nicholas Cole
Dear List, I'm hoping to use the tarfile module in the standard library to move some files between computers. I can't see documented anywhere what this library does with userids and groupids. I can't guarantee that the computers involved will have the same users and groups, and would like the ar

Re: ignore case only for a part of the regex?

2012-12-30 Thread MRAB
On 2012-12-30 17:32, Roy Smith wrote: In article , Vlastimil Brom wrote: you may check the new regex implementation for python http://pypi.python.org/pypi/regex Wow, I wasn't aware of such an effort. At first reading, I'm amused by the concept of "strict fuzzy matching". Those of us with

Re: ignore case only for a part of the regex?

2012-12-30 Thread Roy Smith
In article , Vlastimil Brom wrote: > you may check the new regex implementation for python > http://pypi.python.org/pypi/regex Wow, I wasn't aware of such an effort. At first reading, I'm amused by the concept of "strict fuzzy matching". Those of us with long memories will be confused by the

Re: ignore case only for a part of the regex?

2012-12-30 Thread Vlastimil Brom
2012/12/30 Helmut Jarausch : > Hi, > > is there a means to specify that 'ignore-case' should only apply to a part > of a regex? > > E.g. > > the regex should match Msg-id:, Msg-Id, ... but not msg-id: and so on. > > I've tried the pattern > r'^Msg-(?:(?i)id):' > but (?i) makes the whole pattern

Re: changing process name

2012-12-30 Thread Adam Tauno Williams
On Mon, 2012-11-19 at 10:39 +, andrea crotti wrote: > I have very long processes to spawn which I want to lauch as separate > processes (and communicate with ZeroMQ), but now the problem is that the > forked process appears in "ps" with the same name as the launcher > process. > This is a simpl

Re: ignore case only for a part of the regex?

2012-12-30 Thread Joel Goldstick
On Sun, Dec 30, 2012 at 10:20 AM, Roy Smith wrote: > Helmut Jarausch wrote: > > > is there a means to specify that 'ignore-case' should only apply to a > part > > of a regex? > Python has excellent string methods. There seems to be a split between people who first always grab regex for string

Re: ignore case only for a part of the regex?

2012-12-30 Thread Roy Smith
Helmut Jarausch wrote: > is there a means to specify that 'ignore-case' should only apply to a part > of a regex? Not that I'm aware of. > the regex should match Msg-id:, Msg-Id, ... but not msg-id: and so on. What's the use-case for this? The way I would typically do something like this

Re: New to python, do I need an IDE or is vim still good enough?

2012-12-30 Thread Jamie Paul Griffin
* Yuvraj Sharma [2012-12-28 01:37:23 -0800]: > Use IDLE > -- > http://mail.python.org/mailman/listinfo/python-list > The OP is already a proficient C, C++, perl, ... hacker using console based tools and hardcore UNIX editors like vi(1) - I doubt he'll stay with IDLE for very long - once you'

re: ignore case only for a part of the regex?

2012-12-30 Thread Helmut Jarausch
Hi, is there a means to specify that 'ignore-case' should only apply to a part of a regex? E.g. the regex should match Msg-id:, Msg-Id, ... but not msg-id: and so on. I've tried the pattern r'^Msg-(?:(?i)id):' but (?i) makes the whole pattern ignoring case. In my simple case I could say r'M

Re: Noob trying to parse bad HTML using xml.etree.ElementTree

2012-12-30 Thread Peter Otten
Morten Guldager wrote: > 'Aloha Friends! > > I'm trying to process some HTML using xml.etree.ElementTree > Problem is that the HTML I'm trying to read have some not properly closed > tags, as the shown in line 8 below. > > 1 from xml.etree import ElementTree > 2 > 3 tree = ElementTree >

Re: Noob trying to parse bad HTML using xml.etree.ElementTree

2012-12-30 Thread Chris Angelico
On Sun, Dec 30, 2012 at 8:52 PM, Morten Guldager wrote: > Question is if it's possible to tweak xml.etree.ElementTree to accept, and > understand sloppy html, or if you have suggestions for similar easy to use > framework, preferably among the included batteries? > Check out BeautifulSoup, it's f