Re: [Tutor] Python3.0 and Tkinter on ubuntu 8.10 HOWTO

2009-01-14 Thread Emad Nawfal (عماد نوفل)
Great source for Unicode lovers On Wed, Jan 14, 2009 at 3:53 PM, Robert Berman wrote: > Very good and most welcome. > > Robert Berman > > Vern Ceder wrote: > >> Since there was some interest in the question of how to get a full Python >> 3.0, including Tkinter and IDLE, compiled on Ubuntu Intrep

Re: [Tutor] lists and Entry

2009-01-14 Thread Emad Nawfal (عماد نوفل)
On Wed, Jan 14, 2009 at 5:52 AM, Mr Gerard Kelly wrote: > There is a little Tkinter program. It lets you type something in a box, > and will display it at the command line. > > > from Tkinter import * > > master = Tk() > > e = Entry(master) > e.pack() > > e.focus_set() > > def callback(): > s=e.

Re: [Tutor] python3.0 and tkinter on ubuntu 8.10

2009-01-13 Thread Emad Nawfal (عماد نوفل)
On Tue, Jan 13, 2009 at 4:02 PM, Vern Ceder wrote: > Hi, > > I have Python 3.0/Tkinter/IDLE working fine on Ubuntu 8.10, but it takes a > certain amount of fiddling. > > 1. Make sure the stock Ubuntu Python 3.0 package is not installed > > 2. download the Python 3.0 source from python.org > > 3. i

Re: [Tutor] python3.0 and tkinter on ubuntu 8.10

2009-01-13 Thread Emad Nawfal (عماد نوفل)
t; default under Ubuntu before using it. > YMMV. > > Robert Berman > > Emad Nawfal (عماد نوفل) wrote: > > Hi Tutors,I have downloaded Python3.0 and started playing with it. I like > it because of the utf-8 default encoding, but I'm having trouble importing > tkinte

[Tutor] python3.0 and tkinter on ubuntu 8.10

2009-01-13 Thread Emad Nawfal (عماد نوفل)
Hi Tutors,I have downloaded Python3.0 and started playing with it. I like it because of the utf-8 default encoding, but I'm having trouble importing tkinter. I get the following: >>> import turtle Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.0/turtle.py",

Re: [Tutor] HOW DO I PYTHONIZE A BASICALLY BASIC PROGRAM?

2009-01-12 Thread Emad Nawfal (عماد نوفل)
On Mon, Jan 12, 2009 at 5:23 PM, WM. wrote: > # The natural numbers(natnum), under 1000, divisible by 3 or by 5 are to be > added together. > natnum = 0 > num3 = 0 > num5 = 0 > cume = 0 > # The 'and' is the 15 filter; the 'or' is the 3 or 5 filter. > while natnum <= 999: >num3 = natnum/3 >

Re: [Tutor] commands versus subprocess, I'm confused

2008-12-26 Thread Emad Nawfal (عماد نوفل)
2008/12/26 Kent Johnson > On Fri, Dec 26, 2008 at 8:09 AM, Emad Nawfal (عماد نوفل) > wrote: > > suppose I have an external program that prints "testing the subprocess > > module" > > I know I can run it through the commands module like this: > > > >

Re: [Tutor] beginsWith multiple prefixes

2008-12-26 Thread Emad Nawfal (عماد نوفل)
On Fri, Dec 26, 2008 at 6:47 AM, Alan Gauld wrote: > > "Kent Johnson" wrote > >> for d in os.listdir(): >>> if MyString(d).upper().beginswith(): >>> >> >> But that won't work, the result of calling upper() will be a normal >> str, not a MyString. >> > > Ah yes. Immutability of strings strike

[Tutor] commands versus subprocess, I'm confused

2008-12-26 Thread Emad Nawfal (عماد نوفل)
Hello Tutors, and Happy New Year and Holidays, suppose I have an external program that prints "testing the subprocess module" I know I can run it through the commands module like this: >>> a = commands.getoutput("python3.0 hello.py") >>> a 'testing the subprocess module' >>> len(a) 29 >>> b = a.sp

Re: [Tutor] beginsWith multiple prefixes

2008-12-25 Thread Emad Nawfal (عماد نوفل)
On 12/25/08, Kent Johnson wrote: > > On Wed, Dec 24, 2008 at 4:04 PM, Emad Nawfal (عماد نوفل) > wrote: > > Hi Tutors, > > I want a function that acts like the startswith method, but can take > > multiple prefixes. As an amateur programmer, I came up with this one, and

Re: [Tutor] beginsWith multiple prefixes

2008-12-25 Thread Emad Nawfal (عماد نوفل)
On 12/25/08, Bill Campbell wrote: > > On Wed, Dec 24, 2008, bob gailer wrote: > > Emad Nawfal ( ) wrote: > >> Hi Tutors, > >> I want a function that acts like the startswith method, but can take > >> multiple prefixes. As an amateur programmer, I came up with this one, > >> and it works fi

[Tutor] beginsWith multiple prefixes

2008-12-24 Thread Emad Nawfal (عماد نوفل)
Hi Tutors, I want a function that acts like the startswith method, but can take multiple prefixes. As an amateur programmer, I came up with this one, and it works fine, but my experience tells me that my solutions are not always the best ones around. Can you please tell me what a better option migh

Re: [Tutor] py_compile and chmod +x

2008-12-19 Thread Emad Nawfal (عماد نوفل)
Thank you so much. This has been very helpful. On Fri, Dec 19, 2008 at 12:21 PM, Andreas Kostyrka wrote: > Am Fri, 19 Dec 2008 09:01:24 -0500 > schrieb "Emad Nawfal (عماد نوفل)" : > > You are not supposed to compile the main script. > > pyc files are automatically g

Re: [Tutor] py_compile and chmod +x

2008-12-19 Thread Emad Nawfal (عماد نوفل)
Thank you so much everybody. I was just curious. This has been very useful. On Fri, Dec 19, 2008 at 12:21 PM, Andreas Kostyrka wrote: > Am Fri, 19 Dec 2008 09:01:24 -0500 > schrieb "Emad Nawfal (عماد نوفل)" : > > You are not supposed to compile the main script. > >

[Tutor] py_compile and chmod +x

2008-12-19 Thread Emad Nawfal (عماد نوفل)
Hi Tutors, #! /usr/bin/env python print "Hello Tutors" I have this script saved as hello.py. Why can I execute it, but not the compiled version? or am I doing something wrong? Just curious. Any help appreciated. For example : e...@emad-laptop:~/Desktop/Programming/Haskell$ chmod +x hello.py

Re: [Tutor] newbie question about list element manipulation after split()

2008-10-16 Thread Emad Nawfal (عماد نوفل)
On Thu, Oct 16, 2008 at 4:25 AM, Visvaldas K. <[EMAIL PROTECTED]>wrote: > Hi, > > I feel very stupid, but I am stuck. I could try some workaround, but I want > to understand what I am doing wrong. > > The line: > > for line in open("parameterfile").readlines( ): >print line.split()

Re: [Tutor] newbie question about list element manipulation after split()

2008-10-16 Thread Emad Nawfal (عماد نوفل)
Here is a solution: >>> for line in open('DBAN1001.txt').readlines(): ... line = line.split() ... if len(line) > 1: # This is what makes it work for me. ... print line[1] ... it's have the way that is is prison we It works fine. It seems that in the file you have there are lin

Re: [Tutor] Difficult loop?

2008-10-15 Thread Emad Nawfal (عماد نوفل)
2008/10/15 Emad Nawfal (عماد نوفل) <[EMAIL PROTECTED]> > > > 2008/10/15 John Fouhy <[EMAIL PROTECTED]> > >> 2008/10/16 Emad Nawfal (عماد نوفل) <[EMAIL PROTECTED]>: >> > One more question, >> > I'm a linguistics person, I know some Java

Re: [Tutor] Difficult loop?

2008-10-15 Thread Emad Nawfal (عماد نوفل)
2008/10/15 John Fouhy <[EMAIL PROTECTED]> > 2008/10/16 Emad Nawfal (عماد نوفل) <[EMAIL PROTECTED]>: > > One more question, > > I'm a linguistics person, I know some Java and some Python (and failed to > > learn Prolog). What things do I need to learn to w

Re: [Tutor] Difficult loop?

2008-10-15 Thread Emad Nawfal (عماد نوفل)
d's script was used, just look at the paper in this link: http://jones.ling.indiana.edu/~skuebler/papers/vocal.pdf Thank you so much, Emad 2008/10/15 John Fouhy <[EMAIL PROTECTED]> > 2008/10/16 Emad Nawfal (عماد نوفل) <[EMAIL PROTECTED]>: > > The focus letter will alway

Re: [Tutor] Difficult loop?

2008-10-15 Thread Emad Nawfal (عماد نوفل)
2008/10/15 John Fouhy <[EMAIL PROTECTED]> > 2008/10/16 Emad Nawfal (عماد نوفل) <[EMAIL PROTECTED]>: > > Dear Tutors, > > I needed a program to go through a word like this "Almuta$r~id" > > > > 1- a, i,u, and o are the short vowels > > 2-

[Tutor] Difficult loop?

2008-10-15 Thread Emad Nawfal (عماد نوفل)
Dear Tutors, I needed a program to go through a word like this "Almuta$r~id" 1- a, i,u, and o are the short vowels 2- ~ is the double consonant. I wanted the program to do the following: - For each letter of the word, if the letter is not a short vowel, print the letter with the 5 preceding l

Re: [Tutor] simple python scrip for collocation discovery

2008-08-17 Thread Emad Nawfal (عماد نوفل)
Hello Kent, Bob, Steve Thank you all for your help and suggestions. I believe I 'll have a good program soon. 2008/8/17 Kent Johnson <[EMAIL PROTECTED]> > On 8/16/08, Emad Nawfal (عماد نوفل) <[EMAIL PROTECTED]> wrote: > > #! usr/bin/python > > # Chi-squared collo

Re: [Tutor] simple python scrip for collocation discovery

2008-08-16 Thread Emad Nawfal (عماد نوفل)
Thank you so much Steve, I followed your advice about calculating o the fly and it really rang a bell. Now I have this script. It's faster and does not give me the nasty memory error message the first one sometimes did: # Chi-squared collocation discovery # Important definitions first. Let's suppos

Re: [Tutor] simple python scrip for collocation discovery

2008-08-16 Thread Emad Nawfal (عماد نوفل)
Dear Steve, Thank you so much for your help. Actually this is not homework. It's gonna be used in building a collocation dictionary as part of my dissertation. Please remeber that I'm not a programmer, so many of the terminologies may not be accessible to me. Thank you also for attracting my atten

[Tutor] simple python scrip for collocation discovery

2008-08-16 Thread Emad Nawfal (عماد نوفل)
Hello Tutors, I'm trying to write a small scrip to find collocations using chi squared, depending on a fairly big corpus. The program below does a good job, but it's too slow, and I need to process something like 50 million words. How can I make it run fast? Your help is appreciated. Emad nawfal

Re: [Tutor] Beginner problem: name 'convertToFahrenheit' is not defined

2008-08-14 Thread Emad Nawfal (عماد نوفل)
On Thu, Aug 14, 2008 at 7:08 PM, Joseph Bae <[EMAIL PROTECTED]> wrote: > Hi all, > > I'm new to Python (and programming in general) and need some help! > > Here is my code so far for a temperature conversion program (converts > between Fahrenheit and Celsius): > > > > temp = input("Enter A Number

Re: [Tutor] Reading List from File

2008-07-31 Thread Emad Nawfal (عماد نوفل)
On Thu, Jul 31, 2008 at 8:07 AM, S Python <[EMAIL PROTECTED]> wrote: > Hi Everyone, > > I am trying to read a comma-delimitted list ("aaa","bbb","ccc") from a text > file and assign those values to a list, x, such that: > > x = ["aaa", "bbb", "ccc"] > > The code that I have come up with looks like