[Tutor] Ipython console

2011-05-01 Thread Mateusz Koryciński
Hi, I am using ipython console on one of servers and it's great. Because of that I've tried to install it on my laptop, but unfortunately I am getting this error: Traceback (most recent call last): > File "/usr/bin/ipython", line 26, in > import IPython.Shell > File "/usr/lib/python2.7/d

Re: [Tutor] Compound if statement question.

2011-05-01 Thread Steven D'Aprano
Greg Christian wrote: Is there a way to write an if statement that will pick up duplicates (two ‘1’s): L = ['1', '4', '1'] if (L[0]) != (L[1]) != (L[2]): print "THEY ARE NOT EQUAL" else: print "THEY ARE EQUAL" When I run this code, it prints “THEY ARE NOT EQUAL” when it should print the

Re: [Tutor] Compound if statement question.

2011-05-01 Thread Joel Goldstick
On Sun, May 1, 2011 at 2:28 PM, Greg Christian wrote: > Is there a way to write an if statement that will pick up duplicates > (two ‘1’s): > > L = ['1', '4', '1'] > if (L[0]) != (L[1]) != (L[2]): > print "THEY ARE NOT EQUAL" > else: > print "THEY ARE EQUAL" > > When I run this code, it p

Re: [Tutor] Compound if statement question.

2011-05-01 Thread Corey Richardson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/01/2011 02:28 PM, Greg Christian wrote: > Is there a way to write an if statement that will pick up duplicates (two > ‘1’s): > > L = ['1', '4', '1'] > if (L[0]) != (L[1]) != (L[2]): > print "THEY ARE NOT EQUAL" > else: > print "THEY ARE

[Tutor] Compound if statement question.

2011-05-01 Thread Greg Christian
Is there a way to write an if statement that will pick up duplicates (two ‘1’s): L = ['1', '4', '1'] if (L[0]) != (L[1]) != (L[2]): print "THEY ARE NOT EQUAL" else: print "THEY ARE EQUAL" When I run this code, it prints “THEY ARE NOT EQUAL” when it should print the else “THEY ARE EQUAL”.

Re: [Tutor] Combining two Dictionaries

2011-05-01 Thread Steven D'Aprano
Andre Engels wrote: To answer your question, we have to look at Python's data model, which differs from that in other languages. Strictly speaking, that is true: Python's data model is different from that of (say) C, or Pascal, or Forth. But it's also the same as that in other languages, lik

Re: [Tutor] confusions about re module

2011-05-01 Thread naheed arafat
ya.you'r right. left it accidentally.thanks. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Combining two Dictionaries

2011-05-01 Thread Steven D'Aprano
Knacktus wrote: When I initialize the class which holds these dictionaries, though, I need to make sure that all the keys contained in d2 match the keys of d1. Thus I tried: d1 = {'a': 0, 'b': 0, 'c': 0} Now d1 holds the address of a dict in memory. [...] Let me guess... did you learn C b

Re: [Tutor] confusions about re module

2011-05-01 Thread Peter Otten
naheed arafat wrote: > someone please tell me why i'm getting this output? > specially the 'e3%' ! ! ! import re re.findall('([\w]+.)','abdd.e3\45 dret.8dj st.jk') > ['abdd.', 'e3%', 'dret.', '8dj ', 'st.', 'jk'] > > I am getting the same output for the following too.. re.findall(r