[Tutor] installing python 2.4.1 over 2.4

2005-05-22 Thread Pujo Aji
Hello, I have python 2.4. I would like to install python 2.4.1, Should I uninstall python 2.4, or just install 2.4.1? Does it effect my ide such as pydev and komodo ? Sincerely Yours, pujo ___ Tutor maillist - Tutor@python.org http://mail.python.org/

Re: [Tutor] Sorting a directory

2005-05-24 Thread Pujo Aji
you can sort listsource based on listkey For example: you have listsource = ['c','b','a'] and listkey = [2,3,1] # this will be used to sort listsource. def sortbasedlist(sources,keys): #combine (key,sources) Kombin = [(keys[i],sources[i]) for i in range(len(sources))] Kombin.sort() return

Re: [Tutor] Am I making this harder than it needs to be?

2005-05-25 Thread Pujo Aji
try this code: L = [(1,11),(2,22)] print max(L) print min(L) I don't know if that what you want. good luck pujo On 5/25/05, Ron Phillips <[EMAIL PROTECTED]> wrote: > > short version: I need a way to get max and min E and N out of > [(E0,N0),(E1,N1)...(En,Nn)] without reordering th

Re: [Tutor] (no subject)

2005-05-26 Thread Pujo Aji
AIL PROTECTED]> wrote: > With the help of Pujo Aji I have written this little script that print every > single ASCII code>> > > S = [chr(x) for x in range (0,256)] > for x in S: > print x, > > The next step is to use the built-in functin ord() in order to convert eac

Re: [Tutor] a generic table data structure for table / 2d array / lookup table?

2005-05-28 Thread Pujo Aji
][col] except: return None pass if __name__ == '__main__': mytab = mytable() mytab.input(1,'A','cat') # Ok print mytab.output(1,'A') # it will result 'cat' # Not Ok --> No Data print mytab.output(2,'B') # it

Re: [Tutor] Planning a program with algorithm?

2005-05-29 Thread Pujo Aji
Before you write algorithm it is always good to know every aspect of the programing language you will use. python has built in function like set, data like list, dictionary, style like list comprehension, lambda etc that worth knowing before you start to write algorithm. It is always good to

Re: [Tutor] insering into lists through slices

2005-06-03 Thread Pujo Aji
when you operate slice be carefull of the position of pointer which slice the list: L = [0 , 1 , 2 , 3] ^ ^ pos 0 1 That's why : L = [1,2,3] L[0:1] = [7] print L # will replace element 1 L = [1,2,3] L[1:1] = [7] print L # will insert 7 between element 1 and 2

Re: [Tutor] how to generate random numbers in Python

2005-06-04 Thread Pujo Aji
Don't forget to call : import random try: import random print random.randint(2,8) print random.random() good luck pujo On 6/4/05, Xiaoxia Xu <[EMAIL PROTECTED]> wrote: > Hello, > > I tried to use a Python library module random() to generate some > noise to my data. But the interpreter gave me

Re: [Tutor] resizing an array of strings?

2005-06-06 Thread Pujo Aji
Try this code: def myfuncSplit(row,col,myList): RBig = [] cou=-1 for i in range(row): RSmall= [] for j in range(col): cou+=1 RSmall.append(myList[cou]) RBig.append(RSmall[:]) return RBig if __name__== '__main__': myString = ['hi','my','name','is','Jeff']

Re: [Tutor] Running range scripts in IDE

2005-06-10 Thread Pujo Aji
On 6/10/05, typetext <[EMAIL PROTECTED]> wrote: > I am using I. Langingham's Teach yourself Python in 24 hours, and up > to chapter 4 I had no problem. I have installed the IDE , and as far > as I know, all the other programs associated with Python, and had been > batting along with no problem, usi

[Tutor] is this a bug global i ???

2005-06-14 Thread Pujo Aji
I have code like this: class A: def __init__(self,j): self.j = j def something(self): print self.j print i# PROBLEM is here there is no var i in class A but it works ??? if __name__ == '__main__': i = 10 a = A(5) a.something() I don't define global i but it w

[Tutor] can't see emacs timer in action

2005-06-14 Thread Pujo Aji
Hello, I tried this code in emacs. for i in range(3): time.sleep(1) print i It shows the result but total result not second per second. Any one experiance this problem pujo ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/lis

Re: [Tutor] can't see emacs timer in action

2005-06-15 Thread Pujo Aji
interpreter do you have any idea. For this moment I use SciTE and I want to learn using xemacs. Thanks in advance, pujo On 6/15/05, Danny Yoo <[EMAIL PROTECTED]> wrote: > > > On Wed, 15 Jun 2005, Pujo Aji wrote: > > > Thanks Danny, > > > > Btw, I use xema

Re: [Tutor] can't see emacs timer in action

2005-06-15 Thread Pujo Aji
thanks Noel, It is great idea. pujo On 6/15/05, Max Noel <[EMAIL PROTECTED]> wrote: > > On Jun 14, 2005, at 23:17, Pujo Aji wrote: > > > I just use Ctrl+C Ctrl+C to run the code. > > The code wait for 3 second and show all i all together. > > > > I can

Re: [Tutor] can't see emacs timer in action

2005-06-17 Thread Pujo Aji
n big things. Do you have an advice? pujo On 6/15/05, Max Noel <[EMAIL PROTECTED]> wrote: > > On Jun 14, 2005, at 23:17, Pujo Aji wrote: > > > I just use Ctrl+C Ctrl+C to run the code. > > The code wait for 3 second and show all i all together. > > > >

Re: [Tutor] can't see emacs timer in action

2005-06-17 Thread Pujo Aji
wrote: > > > On Wed, 15 Jun 2005, Pujo Aji wrote: > > > Thanks Danny, > > > > Btw, I use xemacs now does it has folding class and method capabilities? > > Hi Pujo, > > [Note: in replies, please make sure to put tutor@python.org in CC.] > > &

Re: [Tutor] can't see emacs timer in action

2005-06-17 Thread Pujo Aji
Hello Alan, thanks for the advice, but I don't understand why xemacs doesn't fix C-c C-c so we don't have to do such many things. in fact C-c C-c is fail to represent the well 'run' behaviour of python ? It would be nice to people who use python get the same benefit of typing C-c C-c and get the

Re: [Tutor] can't see emacs timer in action

2005-06-17 Thread Pujo Aji
Before I use xemacs I use emacs and both are the same. I don't know if there is connection between cpython and problem in showing real time console, because both use cpython. I also want to hear people who use python and emacs/xemacs concerning this problem. pujo On 6/17/05, Alan G <[EMAIL PROTE

Re: [Tutor] MySQL Connection Function

2005-06-21 Thread Pujo Aji
This a very simple connection using mysql. 1. connect to mysql: db = mySQLdb.connect(user='root',passwd='something') 2. To execute and get the result: c = db.cursor() c.execute(sql comment) result = c.fetchall() you can wrap it in a class object. pujo On 6/21/05, Don Parris <[EMAIL PROTECTED]>

Re: [Tutor] Initialising attributes with random values

2005-07-05 Thread Pujo Aji
use : random.randint(1,5) so complete code will be: class something: def __init__(self, name): self.name = name self.size = random.randint(1,5) self.strength = random.randint(1,5) pujo On 7/5/05, Max Russell <[EMAIL PROTECTED]> wrote: > Hello there; > > If I hav

Re: [Tutor] Giant Calc runs, but need advice on how to make the menu repopup.

2005-07-12 Thread Pujo Aji
you can wrap your code with while statement that check a user input received at the end of every calculation you made whether go back to main menu or not. pujo On 7/12/05, Nathan Pinno <[EMAIL PROTECTED]> wrote: > > It runs but now how do I make it go back to the previous menu (e.g. from Add >

Re: [Tutor] This should be easy

2005-07-18 Thread Pujo Aji
the code looks ok for me, Can you post more specific, including the error ? pujo On 7/18/05, nephish <[EMAIL PROTECTED]> wrote: > Hey there, > > i have a script that i am trying to use to add a record to a MySQL > database. > > i keep getting a syntax error. > > this works > cursor.execute("I

Re: [Tutor] Getting started

2005-07-20 Thread Pujo Aji
try python 2.4.1 from this web site: http://www.python.org/download/ cheers, pujo On 7/20/05, Brett C. <[EMAIL PROTECTED]> wrote: > Which Python version should I download, I have Windows XP and am just > getting started in the programming area so alot of the descriptions are to > confusing for

[Tutor] matplotlib (pylab) backends

2005-07-27 Thread Pujo Aji
Hello I write a program which launch pylab from windows GUI (using wxpython). I found some problem here. If I use the default backends program in matplotlibrc which is TkAgg I have this result: 1. I click button the plot is showed 2. I close the plot 3. I click the button to show the plot the se

Re: [Tutor] Multiple Simultaneous Loops

2005-09-15 Thread Pujo Aji
assume: you have two list with the same size L1 = [1,2,3] L2 = [11,22,33]   you can zip the L1 and L2 into L L = zip(L1,L2)  # L = [(1,11),(2,22),(3,33)]    then you can process: for x in L:   dosomething(x[0])...   dosomething(x[1])...   I'm not so sure about your problem but If you want to do som

Re: [Tutor] simplifying with string-formatting operator

2005-09-23 Thread Pujo Aji
hello,   you can use this model:     day, month, year = input("Please enter the day, month and year numbers: ")     date1 = '%s/%s/%s' % (month, day, year)     months = {1:"January", 2:"February", 3:"March", 4:"April", 5: "May", 6: "June", 7: "July", 8: "August", 9: "Septe

Re: [Tutor] Binary 2 text & text 2 binary

2005-09-24 Thread Pujo Aji
If your symbol are specific it is better to use dictionary. then if the user give an input you can take character by character and translate into your binary. This is the code textTobinary:     mydic = {'A' : "0101", 'B' : "0110", 'C' : "0111"}    strinput = 'ABBC'    result = [mydic[x]

Re: [Tutor] Help with pi and the math module.

2005-09-24 Thread Pujo Aji
hi,   if you use : import math you can type: diameter * math.pi   if you use from math import * you can type: diameter * pi   Cheers, pujo  On 9/24/05, Nathan Pinno <[EMAIL PROTECTED]> wrote: Hi all,   I need help with pi and the math module. I had import math at the top of a program, but when it

Re: [Tutor] creating strings

2005-09-25 Thread Pujo Aji
I will use simple function:   def getscore(val):    if 90 < val <=100:    return 'A'    elif val >= 80:    return 'B'    elif val >= 70:    return 'C'    elif val >= 60:    return 'D'     else:    return 'F'    def main():    g = input('Enter score:')    print 'the score of the

Re: [Tutor] Flattening multi-dimentional list

2005-09-29 Thread Pujo Aji
Hi,   Use this:def _flatten(seq,myhasil): for isi in seq: if type(isi) != str: try: _flatten(isi,myhasil) except: myhasil.append(isi) else: myhasil.append(isi) def flatten(seq): '''code to flatten tupple''' hasil = [] _flatten(seq,hasil) return

Re: [Tutor] installing pydev

2005-10-02 Thread Pujo Aji
I think you should use simple project, and then add a file with extention py   Cheers, pujo  On 10/2/05, Mohammad Moghimi <[EMAIL PROTECTED]> wrote: HiI have download pydev(org.python.pydev.feature-0_9_8_2.zip) from sourceforge.  Then I extract it to my eclipse directory. But When I try to create a

Re: [Tutor] Help Needed

2005-10-05 Thread Pujo Aji
hi,   make sure in the option/general/Startup preferences/at startup/open edit windowoption/general/Startup preferences/autosave preferences/NoPrompt   run the program by clicking F5   Cheers, pujo  On 10/5/05, Steve Haley <[EMAIL PROTECTED]> wrote: Hello,   I am trying to learn Python which I a

Re: [Tutor] handling of tabular data

2005-10-09 Thread Pujo Aji
Hi Frank,   you can use Numeric.py it is also powerfull to handle averages, min, max, matrix algebra, etc.. see: http://www.pfdubois.com/numpy/   You just need to use a list.   If your data is big and you need more power I suggest you use database like mysqldb for python. It is also fun to combine

[Tutor] how to speed up this code?

2005-10-12 Thread Pujo Aji
I have code like this: def f(x,y):     return math.sin(x*y) + 8 * x   def main():     n = 2000     a = zeros((n,n), Float)     xcoor = arange(0,1,1/float(n))     ycoor = arange(0,1,1/float(n))     for i in range(n):         for j in range(n):             a[i,j] = f(xcoor[i], ycoor[j])  # f(x,y) =

Re: [Tutor] how to speed up this code?

2005-10-13 Thread Pujo Aji
hello chun,   I use Numeric. using 'while' instead of for, has the same effect. still slow   pujo  On 10/13/05, w chun <[EMAIL PROTECTED]> wrote: On 10/12/05, Pujo Aji <[EMAIL PROTECTED]> wrote:> I have code like this: >> def f(x,y):> return math.sin(x*y) +

Re: [Tutor] how to speed up this code?

2005-10-13 Thread Pujo Aji
.clock() - t...     >>> time_numeric(10)1.44588097091 On 10/13/05, Pujo Aji < [EMAIL PROTECTED]> wrote: I have code like this: def f(x,y):     return math.sin(x*y) + 8 * x   def main():     n = 2000     a = zeros((n,n), Float)     xcoor = arange(0,1,1/float(n))     ycoor = arange(0,1,1/

Re: [Tutor] Focus on the functions [Was Re: if-else statements]

2005-10-16 Thread Pujo Aji
Dear Norman,   You can reuse function, this make your code more easy to handle. Suppose you have  code  to calculate area of rectangle, but this time you like to calculate 3 times:   width = 3; length = 2 print 'area', width * length   width = 1; length =32 print 'area', width * length   width =

Re: [Tutor] what does %25f mean?

2005-10-24 Thread Pujo Aji
it will reserve the 25 space for your number. example:     print '%25.2f' % (1.222,)   It will use 25 space and 2 digit of your 1.222result is: 1.22   cheers, pujo  On 10/24/05, Shi Mu <[EMAIL PROTECTED]> wrote: what does %25f mean?_

Re: [Tutor] dictionary

2005-10-24 Thread Pujo Aji
you work with dictionary. In dictionary you work with the key to get your value. You don't care about how python arrange the key. your key here are: 'res', 'com', 'ind', and  'other' when you want to get your value you just type: landUse['res'] this you will get 1 landUse['ind'] this you will get 3

Re: [Tutor] string

2005-10-24 Thread Pujo Aji
please show us the code   cheers, pujo  On 10/24/05, Shi Mu <[EMAIL PROTECTED]> wrote: what does the following sentence mean? does it mean i can not usedouble-quoted string?SyntaxError: EOL while scanning single-quoted string ___Tutor maillist  -  Tut

Re: [Tutor] new user question about while loops

2005-10-26 Thread Pujo Aji
Hello,   I'm not so sure about your problem, but probably this code can help       sumHead, sumTail = 0,0     listHeadTime = []    listTailTime = []        for i in range(100):    time_start = time.clock()    coin = random.randint(0,1) # 0 head, 1 tail    time_stop = time.clock()  

Re: [Tutor] while/if/elif/else loops

2005-10-31 Thread Pujo Aji
Let's comment something:1. If you have error please show us your error message.2. When you code python be aware of indention, be persistent for example use tab space 4.3. import should be on the top of your code. 4. to choose random between integer 1 or 0 use randint(0,1)5. your last code use Print

Re: [Tutor] while/if/elif/else loops

2005-11-02 Thread Pujo Aji
Hello,I see two things can be changed a little bit.1. redundant: while, if2. print style at the last statement.see below:#Coin Toss Game#Zameer Manjiimport randomprint "This game will simulate 100 coin tosses and then tell you the number of head's and tails"tosses = 0heads = 0tails = 0while tosses<

[Tutor] avoid eval how???

2005-11-03 Thread Pujo Aji
Hello   I have a dynamic functions which created by some algorithms during runtime. These functions are in string type. When I want to use it, I can use eval command. But can someone give me more suggestion about how to handle this problem, I want to avoid eval.   Example : L = ['x+sin(x)', '1/(2.2

Re: [Tutor] RSH?

2005-11-03 Thread Pujo Aji
try pyro.   Cheers, pujo  On 11/3/05, Mike Hansen <[EMAIL PROTECTED]> wrote: Anyone know of a way to have Python run a command on a remote machine? In myparticular case, I want to run a python program on Windows and run a command on VMS. Would the telnetlib module do it, or is there something bette

Re: [Tutor] Sorting a dictionary

2005-11-04 Thread Pujo Aji
Hallo,   you can also sort based on the values:   >>> list_of_nums = nums.items()>>> list_of_nums.sort(lambda x,y: cmp(x[1],y[1])) Cheers, pujo       On 11/4/05, Danny Yoo <[EMAIL PROTECTED]> wrote: On Fri, 4 Nov 2005, Johan Geldenhuys wrote:> In my new project I needed a dictionary with TCP/UDP p

Re: [Tutor] Percentage

2005-11-07 Thread Pujo Aji
don't forget to use dot or converge into float.perc = 42./250or perc = float(42)/250otherwise:it is treated as integer.pujoOn 07 Nov 2005 11:50:05 -0200, Jorge Godoy <[EMAIL PROTECTED]> wrote: Johan Geldenhuys <[EMAIL PROTECTED]> writes:> What is the syntax if I want to work out what percentage 42

Re: [Tutor] Percentage

2005-11-07 Thread Pujo Aji
nice syntax.   Cheers, pujo  On 07 Nov 2005 12:18:44 -0200, Jorge Godoy <[EMAIL PROTECTED]> wrote: Pujo Aji <[EMAIL PROTECTED]> writes:> don't forget to use dot or converge into float. Or import division from __future__.>>> from __future__ import division&g

Re: [Tutor] lists and strings

2005-11-08 Thread Pujo Aji
yes it is...   convert list to string:     L = [1,2,3]    L = [str(x) for x in L]    s = string.join(L,' ')    print len(s)  convert list to a file     myF = open(namaFile,"w")    for s in myList[:-1]:    myF.write(str(s)+"\n")    myF.write(str(myList[len(myList)-1]))    myF.close()    Cheers,

Re: [Tutor] How to launch executable from a Python script??

2005-11-08 Thread Pujo Aji
Try to add .py in PATHEXT environment windows XP After that, you can call your python program just like you call exe file.   Hope this help. pujo   On 11/8/05, Chris Irish <[EMAIL PROTECTED]> wrote: Hello all :)I made a GUI app with pyGTK that I want to be able to launch a game I'vedownloaded from

Re: [Tutor] Another Quick Question

2005-11-13 Thread Pujo Aji
I use windows, it works for meHave checked your sound card, volume before trying the code?pujoOn 11/14/05, Johan Geldenhuys < [EMAIL PROTECTED]> wrote: Could this be a OS thing? I use Linux and it works here. Steve Haley wrote: Folks,   I'm one of the people new to

Re: [Tutor] Inheriting from parent object

2005-11-14 Thread Pujo Aji
if you want to copy object just use: import copy newobj = copy.deepcopy(objparent)  or just create object which has direct correlation with the parent like: newobj = objparent  Cheers, pujo   On 11/14/05, Alan Gauld <[EMAIL PROTECTED]> wrote: > I want to create a property that will inherit it's val

Re: [Tutor] how to identify a list element is in the range of a tuple element or a list element

2005-11-17 Thread Pujo Aji
for b you can use this code:     a = [10,3,4.6,2.3,4.8,10.8,4.1]    b = ['1-4','4.1-8','8.1-12','12.1-16']    for x in a:    for y in b:    low,up = y.split('-')    if  float(low) < x < float(up):     print '%s   %s - %s' % (x, low, up)    break    Ch

Re: [Tutor] Lists with just an item

2005-11-21 Thread Pujo Aji
Hi,       mydic = {'one': 1, 'two': 2}        # to access key:    for x in mydic.keys():    print x        # to access value --> use key    print mydic['one']   Cheers, pujo On 11/21/05, Negroup - <[EMAIL PROTECTED]> wrote: Hi all.In my application I have chosen as data structure a list ofd

[Tutor] Numeric array incosistence in unittest

2005-11-21 Thread Pujo Aji
hello, I found that if I use Numeric.array into unittest it is not consistance, Is that normal ?   import unittestimport Numeric class myTest(unittest.TestCase):    def runTest(self):    var1 = Numeric.array([1,22])    var2 = Numeric.array([1,33])    self.assertEqual(var1,var2) if __

Re: [Tutor] running a program

2005-11-28 Thread Pujo Aji
this should be the same as running other python code.assuming you use windows,  you can type from dos command :python namefile.pyCheers,pujoOn 11/28/05, David Jimenez <[EMAIL PROTECTED]> wrote: Hello everybody,I have a very simple question: how can I run a script that uses module Tkinter witho

Re: [Tutor] rare matrix

2005-11-30 Thread Pujo Aji
try numeric or numpy in :http://www.numpy.org/Cheers,pujoOn 11/30/05, János Juhász < [EMAIL PROTECTED]> wrote:Dear All,do you know any python solution to handle big big rare matrices effectively with python.I would make matrix multiplications with 3000x3000 matrices, but with 1-2%data in them.Could

[Tutor] python swig problem

2005-12-01 Thread Pujo Aji
Hi, I tried to follow the example in swig homepage. I found error which I don't understand. I use bcc32, I already include directory where my python.h exist in bcc32.cfg.  /* File : example.c */  #include  double My_variable = 3.0;  int fact(int n) {      if (n <= 1) return 1;      els

[Tutor] distutils python 2.4.2 winxp, microsoft visual studio 2005 problem

2005-12-05 Thread Pujo Aji
Hello,I try to call setup build and found this problem:running buildrunning build_ext*** Failed: error: The .NET Framework SDK needs to be installed before building extensions for Python.I have .NET Framework SDK already. Is there anyone experiance this problem ?I also found some information about

Re: [Tutor] Timer

2005-12-06 Thread Pujo Aji
Probably the simplest thing is to make the computer sleep in a specific time.Example:def main():    time.sleep(2) # sleeping 2 second    print 'finish'Cheers,pujo On 12/6/05, Joseph Quigley <[EMAIL PROTECTED]> wrote: I'd like to make a 30 minute timer. How an I do that? With time? Thanks,    Joe--

Re: [Tutor] information needed to make a connection between computers

2005-12-12 Thread Pujo Aji
yes you can do that in python.But I recommend to use pyro.http://pyro.sourceforge.net/pujoOn 12/11/05, John Walton <[EMAIL PROTECTED]> wrote:  Hello again! I'm still working on that instant messenger (for science fair), and I have been reading about networking in some Java tutorials. In one part

Re: [Tutor] Guess my number game

2005-12-15 Thread Pujo Aji
Hi, your guess still use random.randrange that's make computer doesn't care about whether guess is low or higher than your number.This code should be like this:    print "\t\t\tWelcome to \"Guess My Number\"!"     print "\nThink of a number between 1 and 50."    print "I will try to guess it in as

Re: [Tutor] float question

2005-12-20 Thread Pujo Aji
Th format %x1.x2fwhere x1 is the total space and x2  is decimal digit place.If your data is longer than the specified x1 and x2.the data rules.Look at 3.14 takes 4 places total# 4 places rules >>> '%3.2f' % 3.14'3.14'# perfect>>> '%4.2f' % 3.14'3.14'# try this >>> '%5.2f' % 3.14' 3.14'Cheers,pujo O

Re: [Tutor] Differnce between java and python

2005-12-21 Thread Pujo Aji
Hi,you can check this website:http://www.ferg.org/projects/python_java_side-by-side.htmlabove all.python is very compact, clear language. I did some code using C# for 1 year, and when I move to python I can rewrite it even more in about 3 months.My code becomes clearer than ever beforeCheers,pu

Re: [Tutor] Numeric import error

2005-12-22 Thread Pujo Aji
Can you open the python interpreter and write:import NumericWhat kind of error message you have?Cheers,pujoOn 12/22/05, Johan Geldenhuys <[EMAIL PROTECTED]> wrote:Hi all, I have installed Numeric (Suse 10.0) and it is in my site-packagesfolder, but I can't import the module.Any idea how to fix thi

Re: [Tutor] Numeric import error

2005-12-22 Thread Pujo Aji
Do you have other modules in your site-packages directory ?Such as spe, pyro, pyrobot etc.On 12/22/05, Johan Geldenhuys < [EMAIL PROTECTED]> wrote: >>> import Numeric Traceback (most recent call last):   File "", line 1, in ? ImportError: No module named Numeric

Re: [Tutor] Numeric import error

2005-12-22 Thread Pujo Aji
Can you find numeric.py inside your numeric folder ?On 12/22/05, Pujo Aji <[EMAIL PROTECTED]> wrote: Do you have other modules in your site-packages directory ?Such as spe, pyro, pyrobot etc. On 12/22/05, Johan Geldenhuys < [EMAIL PROTECTED]> wrote: >>> import Nu

[Tutor] Numeric RandomArray seed problem.

2006-01-01 Thread Pujo Aji
Hello,I tried calling RandomArray.seed()by calling RandomArray.get_seed() I get the seed number (x,y).My problem is that x is always 113611 any advice?Thankspujo ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Numeric RandomArray seed problem.

2006-01-01 Thread Pujo Aji
Thank you Kent.pujoOn 1/1/06, Kent Johnson <[EMAIL PROTECTED]> wrote: Pujo Aji wrote:> Hello,>> I tried calling RandomArray.seed()> by calling RandomArray.get_seed() I get the seed number (x,y).> My problem is that x is always 113611 any advice?Take a look at the source for R

Re: [Tutor] "while" loop for satisfing two conditions , advice requested

2006-01-15 Thread Pujo Aji
in understanding while loop someone should understand "if conditional" first.In "If conditional" there are common relational symbol "and" and "or"Let's discuss  "and" conditional Condition 1 Condition 2  ResultTrue    True    TrueTrue    F

Re: [Tutor] string object into reference

2006-01-17 Thread Pujo Aji
Hello Kirk,If I'm not mistaken your idea is referencing two columns: first column is your acid name and the later is your surface area.Later you want to connect the surface area if you name the acid name.If that what you want another question arises... is your acid name is unique. If it is you can

Re: [Tutor] Python + MySQL , my first simple program does not gives results

2006-01-19 Thread Pujo Aji
You should fetch the results.   try:    result = cursor.fetchall()   print result Cheers,pujo import MySQLdbclass learnpython_db:def __init__(self): db =MySQLdb.connect(host="localhost",user ="john",password = "asdlkj", db = learnpython)cursor = db.cursor(

Re: [Tutor] Indexing in a series for a newbie

2006-01-19 Thread Pujo Aji
Hello Jon,Why don't use randint so you can record the index and the value Example:    WORDS = ("python", "program", "code", "xylophone")    Indword = random.randint (0,len(WORDS)-1)    word = WORDS[Indword]    print Indword    print wordCheers,pujoOn 1/19/06, Jon Moore < [EMAIL PROTECTED]> wrote:He

Re: [Tutor] how to do multiple searching against many lists

2006-01-19 Thread Pujo Aji
Yes you can.you can make:    search_list =['cat','python','parrot','donkey','e.coli']    animals = ['python','cat','tiger','donkey','zebra','lemur']    birds = ['parrot','mina','oriole','blue jay']    bacteria = [' e.coli','bacillus','staphy','acetobacter']    mydic = {}    for animal in animals :

Re: [Tutor] processing a text file w/ OO?

2006-01-22 Thread Pujo Aji
you can use regex if you want.It gives you power to do text processing.OO will give you benefit because your program becomes clearer while it  is developedCheers,pujo On 1/23/06, Michael <[EMAIL PROTECTED]> wrote: Hi.I'm processing a tab-delimited text file where I read in a file,perform a bunch of

Re: [Tutor] How can I clean the screen

2006-01-23 Thread Pujo Aji
Try :import osos.system('cls')you will able to see the effect when you run in windows console.Cheers,pujoOn 1/23/06, Suri Chitti <[EMAIL PROTECTED]> wrote:Dear group,    If I am executing a python prog from the command line andneed to clear the screen (like using the cls command at the win

Re: [Tutor] Getting started - IDLE won't run

2006-03-23 Thread Pujo Aji
Hello Ross,Can you see pythonw in the task manager process after you run idle ?Please look at this website concerning some firewall that can stop idle: http://www.python.org/download/releases/2.4.2/bugs/Cheers,pujoOn 3/23/06, Shaun Ross <[EMAIL PROTECTED] > wrote: Hi Group,   I'm just getting

Re: [Tutor] Object Oriented Programmin

2006-03-28 Thread Pujo Aji
Object is object, means like ordinary object we know.Let's say good things about objecs paradigm.First you can create object of course. object can contain property and action.You can put your object as part as other object. It makes sense since for example object hand is part of object body in huma

Re: [Tutor] Alternating patterns

2006-03-28 Thread Pujo Aji
Hi,you can also use simple way of iterating using modus:    L = [1,2]    for i in range(6):    print L[i%len(L)]121212Cheers,pujo On 3/29/06, kevin parks <[EMAIL PROTECTED]> wrote: -->> Message: 10> Date: Tue, 28 Mar 2006 22:43:38 -0500> From: Kent Johnson <[EMA

Re: [Tutor] get a character of an ascii-value

2006-03-28 Thread Pujo Aji
Hello use this function:    print ord('a')    print chr(97)Cheers,pujoOn 3/29/06, Keo Sophon < [EMAIL PROTECTED]> wrote:Hi all,I wonder how to get a character of an Ascii-value.  For example, i have r = 37. So i wanna print the character of 37. Is there any function?Thanks,Sophon___

Re: [Tutor] ASCII

2006-03-28 Thread Pujo Aji
Hi Kaushal,Please clarify the problem more specific.Or you can tell us that you have a problem and want to use python to solve it?Sincerely Yours,pujoOn 3/29/06, Kaushal Shriyan <[EMAIL PROTECTED]> wrote: Hi AllHow do i use this ASCII values in my day to day activities, I am going throughlearning

Re: [Tutor] ASCII

2006-03-29 Thread Pujo Aji
Hello,Basicaly, You use ASCII or Unicode when you have to deal with character conversion for example coding with a different language symbol, chinese letter etc. Sincerely Yours,Pujo On 3/29/06, Kaushal Shriyan <[EMAIL PROTECTED]> wrote: On 3/29/06, Pujo Aji <[EMAIL PROTECTED]> wrote:&

Re: [Tutor] newbie question about default arguments

2006-03-29 Thread Pujo Aji
Hello Josh,you wrote a different problem. The tutorial should be like this: Important warning: The default value is evaluated only once. This makes a difference when the default is a mutable object such as a list, dictionary, or instances of most classes. For example, the following function accum

Re: [Tutor] Explanation of Lists data Type

2006-04-12 Thread Pujo Aji
Hello,On 4/12/06, Kaushal Shriyan <[EMAIL PROTECTED]> wrote: Hi AllI am referring to http://www.ibiblio.org/obp/thinkCSpy/chap08.htm8.7 List slices>>> list = ['a', 'b', 'c', 'd', 'e', 'f'] >>> list[1:3]['b', 'c']  -> I understood this  >>> list[:4]  -

Re: [Tutor] Explanation of Lists data Type

2006-04-12 Thread Pujo Aji
Sorry for the last explanationsthere is a correction!On 4/12/06, Pujo Aji <[EMAIL PROTECTED]> wrote: Hello, On 4/12/06, Kaushal Shriyan <[EMAIL PROTECTED] > wrote: Hi AllI am referring to http://www.ibiblio.org/obp/thinkCSpy/chap08.htm 8.7

Re: [Tutor] underscore function

2006-04-13 Thread Pujo Aji
Python programmers prefer to use name convention to make method of class "looks" private.Usually they use of '_' before the private method or private attribute name.This private method like the one you mentioned def _abc is not intentionaly used outside the class other then it is used among other c

Re: [Tutor] MySQLdb question

2006-04-14 Thread Pujo Aji
I think you can wrap the select sql command with a function which return a string.this function receive a particular hostname in a string format and return the whole 'SELECT ... FROM.. WHERE' style including the hostname from the function argument. Cheers,pujoOn 4/14/06, Patty <[EMAIL PROTECTED]> w

Re: [Tutor] is gotchas?

2006-11-06 Thread Pujo Aji
For small string object python has optimization method so it is really the same object!Cheers,pujoOn 11/7/06, Tim Johnson < [EMAIL PROTECTED]> wrote:* Kent Johnson < [EMAIL PROTECTED]> [061106 10:31]:>> In [9]: a=[1,2]>> In [10]: b=[1,2]  Hmmm! Hmmm!  Lookee here:  ## console session>>> a=[1,2]>>>

Re: [Tutor] free IDE for Python?

2006-11-13 Thread Pujo Aji
Try scite:http://www.scintilla.org/SciTE.htmlpujoOn 11/14/06, Vadhri, Srinivas < [EMAIL PROTECTED]> wrote: Hi   A newbie to Python. What is the free IDE for Python development activities? ActiveState's Komodo IDE needs a license and a fee.   Any recommendations?   Regards, Srini