Hi,
A newbie re query.
>>> import re
>>> s='one'
>>> re.sub('(one)','only \\0',s)
'only \x00'
>>> re.sub('(one)','only \0',s)
'only \x00'
I expected the output t
(two)', r'\1 - \2',s)
'one - two'
In first sub I expected,
one two - one two
I understand that \1 is first (group), \2 the second and etc.
But what is the entire regex?
With warm regards,
-Payal
--
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
t;0> refers to the
> entire group.
Thanks a lot. It works as you say.
With warm regards,
-Payal
--
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
Hi all,
I know the difference between
class Parent :
class Parent(object) :
But in some softwares i recall seeing,
class Parent() :
Is this legal syntax?
With warm regards,
-Payal
--
___
Tutor maillist - Tutor@python.org
To unsubscribe or
Hi,
If I have a list (or a dict), is there any way of knowing how many other
variables are referencing the same object?
With warm regards,
-Payal
--
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http
>
> or
>
> class Name(): pass
>
> In Python 3.x, there are no old-style classes.
Thanks, that clears my doubt.
With warm regards,
-Payal
--
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
h
Hi all,
Excuse for TOFU. Thanks a lot Steven, Dave and Hugo.
Steven the explanation was really great. Thanks a lot for it.
Hugo, I was just curious, have no real need. Thanks.
With warm regards,
-Payal
--
On Tue, Jun 08, 2010 at 08:07:28PM +1000, Steven D'Aprano wrote:
> On Tue, 8 Jun
s(F)
gives PicklingError: Can't pickle : it's not found
as __main__.F
What is my mistake? I want to pickle and shelve classes as well as
instances.
With warm regards,
-Payal
--
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscr
On Thu, Jun 17, 2010 at 11:11:11AM +0200, Eike Welk wrote:
> I think it is a bug in IPython: I can do this in regular Python, but in
> IPython I get the same error that you get:
>
Thanks a lot. It works in normal python. Thanks again.
With warm regard
in
File "/usr/lib/python2.6/shelve.py", line 122, in __getitem__
value = Unpickler(f).load()
AttributeError: 'module' object has no attribute 'F'
How do I carry around my classes and instances?
With warm regards,
-Payal
--
___
On Fri, Jun 18, 2010 at 03:16:36PM +0200, Eike Welk wrote:
> See:
> http://docs.python.org/library/pickle.html#what-can-be-pickled-and-unpickled
Thanks for the link and the explanation.
With warm regards,
-Payal
--
___
Tutor maillist -
Hi,
Is it possible to solve the below, w/o making a re object?
>>> a
'Mary Had a Little Lamb'
>>> p=re.compile('l',re.I)
>>> re.sub(p,'-',a)
'Mary Had a -itt-e -amb'
I cannot figure
syntax of each is so different you are
> less likely to get confused, but the underlying programming model is very
> similar in each case.
Hijacking the thread a bit. What about learning Jython and Python? Do I
need to know Java to learn Jython?
a lot Evert. For records,
>>> re.sub('l(?i)','-',a)
'Mary Had a -itt-e -amb'
With warm regards,
-Payal
--
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
a few times over, I fail to get utility
of such a class. Can someone please explain with better example?
Alan can you please cleanup that section, maybe make it broader and put
the stuff about "SystemExit" elsewhere.
Thanks a lot in advanc
pass
Can we say that our own exception classes have only maybe a doc-string
and pass, nothing more?
Thanks a lot again.
With warm regards,
-Payal
--
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
says,
bottom-top, left-right. So we expected D-B-A-C-A.
Steven says in some cases even this simple logic of bottom-top,
left-right search will not work. As he says, a simple example of it
failing is diffclt to write, so meanwhile I will take his word for it.
Thanks for the help.
With warm
Hi Steven,
Thanks a lot for patiently explaining the concepts. I uderstood most of
it.
With warm regards,
-Payal
--
On Sun, Jun 27, 2010 at 10:09:38AM +1000, Steven D'Aprano wrote:
> Probably not... it's quite complicated, which is why it's rare. I'll
> have a thi
Thanks a lot Eike for the code snippet. I got the idea now.
With warm regards,
-Payal
--
On Sat, Jun 26, 2010 at 10:41:59PM +0200, Eike Welk wrote:
> Hello Payal!
>
> On Saturday June 26 2010 19:05:16 Payal wrote:
> > Can we say that our own exception classes have only may
of writing,
except (NameError, ZeroDivisionError) as e: print 'Msg : ' , e
c. What is the correct Python of writing,
except as e: print 'Msg : ' , e# Capturing all exceptions
Thanks a lot for the help in advance.
With warm regards,
-Payal
--
p.s. I am always confused wher
tements? A simple example of both in Python will suffice.
b. I read on web that Python has in new releases done "unifications of
types and classes". I know what classes are, what are types in simple
language.
Again please excuse for simple questions and thanks a lot in advance.
With
lectronics enggs. so they do not expect real
swell gui, but it should be bearable and more importantly easy for me to
learn, cos' I have a day time job and I am doing this just as a help and
eagerness to learn.
Looking for advice.
Thanks a
t), if it is easy to
learn? (I liked fetchmailconf and I think it was done in tkinter).
I get discouraged a bit fast, so I want the first toolset to be as easy
as possible.
With warm regards,
-Payal
--
___
Tutor maillist - Tutor@python.org
To u
0.1): icmp_seq=4 ttl=64 time=0.046 ms\n64 bytes from
localhost (127.0.0.1): icmp_seq=5 ttl=64 time=0.049 ms\n\n--- localhost
ping statistics ---\n5 packets transmitted, 5 received, 0% packet loss,
time 3997ms\nrtt min/avg/max/mdev = 0.044/0.047/0.052/0.006 ms\n', None)
>>>
hth,
With w
('War & Peace", [3,56,88]),
> Book("Huck Finn", [2,5,19]) ]
Can someone please explain the above 2 lines?
> for book in Books:
> print book.title, book.pages
With warm regards,
-Payal
--
___
Tutor maillist
Hi all,
Can someone please give a very simple example of using __new__ wherein
__init__ cannot be used?
With warm regards,
-Payal
--
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org
On Tue, Aug 31, 2010 at 08:27:10AM +0200, Peter Otten wrote:
> Subclasses of immutable types, e. g. tuple:
That was one great example, thanks. Some doubts,
a. I have seen this cls before, what does it mean?
b. What does type(_) mean?
Thanks a lot in advance.
With warm regards,
-Pa
lot.
With warm regards,
-Payal
--
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
Hi all,
Can someone suggest a resource for me to learn threading in python? I
don't know threading in any other language.
I tried a few online tutorials but got lost soon. How do I start?
With warm regards,
-Payal
--
___
Tutor maillist -
months?
With warm regards,
-Payal
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
illy problems like generate fibonnacci
series, add numbers frm 0-n etc. non required silly stuff.
With warm regards,
-Payal
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
ueries I have.
With warm regards,
-Payal
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
quot;?
The Python video said that one can take this language to good level in 1
afternoon, for me it has been 2 months and more. What is wrong?
With warm regards,
-Payal
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
t; for I do not understand
the meaning
of the same)
With warm regards,
-Payal
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
depending on
> the function.
Sorry but it is very confusing, couldn't get it at all.
With warm regards,
-Payal
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
, but you have confused me more ;)
Can you give an simple example of just function() ?
Where can it be useful?
And when you say it returns a value, what do you mean by that? return to
whom and what exactly?
With warm regards,
-Payal
___
Tutor maill
What is the difference between,
>>> def f(x):
... return x
...
>>> f(4)
4
>>> def f(x):
... print x
...
>>> f(4)
4
Both give same results. So, why return statement is needed?
With warm regards,
-Payal
only the
|data attributes but the operations that are available too.
What are exactly "data attributes" and what "operations" is he referring
to?
With warm regards,
-Payal
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
ng on it in next few days.
Thanks again.
With warm regards,
-Payal
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
variable, and object and difference
between them.
Thanks again.
With warm regards,
-Payal
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
an I
don't want to learn Vbscript or Javascript, what do I do then, am I
supposed to skip those parts?
With warm regards,
-Payal
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
from advanced set, so please give me exercises based on those topics
i.e. don't tell me to code a http client or a GUI based program in
Python :)
With warm regards,
-Payal
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
w do I start?
With warm regards,
-Payal
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
On Tue, Apr 25, 2006 at 06:59:29PM +1200, Liam Clarke wrote:
> Hi Payal,
>
> I see you're connecting to an smtp server Any particular reason yoou
> can't use smtplib?
> http://www.python.org/doc/current/lib/module-smtplib.html
Because I don't know it exists :)
But
you use it as module? I haven't understood the
explantaion.
With warm regards,
-Payal
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
, but unable to figure how to open multiple simeltaneous
connections.
With warm regards,
-Payal
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
46 matches
Mail list logo