Re: [Tutor] More problems with Learning Python example (fwd)

2005-08-12 Thread Danny Yoo
-- Forwarded message -- Date: Fri, 12 Aug 2005 00:29:00 -0500 (CDT) From: "->Terry<-" <[EMAIL PROTECTED]> To: Danny Yoo <[EMAIL PROTECTED]> Subject: Re: [Tutor] More problems with Learning Python example -BEGIN PGP SIGNED MESSAGE- Hash: SHA1

Re: [Tutor] pattern matching is too slow

2005-08-12 Thread Danny Yoo
On Fri, 12 Aug 2005, Vinay Reddy wrote: > I'm using the following code to read from 'mplayerOut': > > while True: > try: > temp = self.mplayerOut.readline() >print temp >if re.compile("^A:").search(temp): > print "abc" > except StandardError: > break > > If th

Re: [Tutor] i want to build my own arabic training corpus data and use the NLTK to deal with

2005-08-12 Thread Danny Yoo
On Fri, 12 Aug 2005, enas khalil wrote: > hi Danny, Thanks for this help It is now ok to tokenize my text but the > next step i want is to use tagger class to tag my text with own tags. > how can i start this? Hi Enas, I'd strongly recommend you really go through the NTLK tutorials: the develo

Re: [Tutor] Invoking bash from within a python program

2005-08-13 Thread Danny Yoo
On Sat, 13 Aug 2005, Vinay Reddy wrote: > > Anyway, how do I call bash to run a program - e.g. slocate - from > > within a python program. I believe that I have to import the OS first > > (or do I?) and I was thinking something like: > > > > ... > > sh slocate file_name > python_defined_list > >

Re: [Tutor] iterating in the same line

2005-08-13 Thread Danny Yoo
On Sat, 13 Aug 2005, Jonas Melian wrote: > I would check 3 words at the starting of a line > > s=['foo','bar','qwe'] > > if ln.startswith(s): (this is bad) Hi Jonas, Just checking: is this similar to a question brought up a few days ago? http://mail.python.org/pipermail/tutor/2005-Augu

Re: [Tutor] Sorting a list of lists aka nested lists

2005-08-13 Thread Danny Yoo
On Sat, 13 Aug 2005, Jim Roush wrote: > I have a python script that creates a list of lists like so: > > Quant.append( [ db_ticker, stock_close, MTD, 0, QTD, 0, YTD, 0, 0, 0 ] ) > > After Quant is created, I want to sort it by MTD. If I use a simple > Quant.sort(), I assume its going to sor

Re: [Tutor] Sorting a list of lists aka nested lists

2005-08-13 Thread Danny Yoo
> >AMK has written a nice mini-tutorial on how to use a list's sort() > >effectively: > > > >http://www.amk.ca/python/howto/sorting/sorting.html > > > >Does his tutorial make sense, or are there parts in there that are > >baffling? Please feel free to ask questions on it, and we'll try to >

Re: [Tutor] Is there anyway to set how many numbers are used after the decimal in floating numbers?

2005-08-18 Thread Danny Yoo
On Thu, 18 Aug 2005, Nathan Pinno wrote: > Is there anyway to set how many numbers are used after the decimal in > floating numbers? It would be nice if the answer could be rounded to 2 > decimal spots, instead of the ten millionths spot. Hi Nathan, If you want to print a number with two decim

Re: [Tutor] Linux/Window Differences in Python?

2005-08-18 Thread Danny Yoo
On Thu, 18 Aug 2005, Catherine Kostyn wrote: > Are there any differences in Python between operating systems or is it > really compatible with the majority of operating systems? Hi Catherine, Python does support platform-dependent extensions, and those are used for things like integrating in

Re: [Tutor] Searching Sorted Lists

2005-08-19 Thread Danny Yoo
> Hi, Can someone tell me if there is a bulit in Binary search function > for python lists ? > > I am currently building lists and sorting them with a comparison > function. The only list search function I know is List.Index(X), which > is pretty inefficient I reckon, especially hen the lists are

Re: [Tutor] How do you turn something into a number?

2005-08-19 Thread Danny Yoo
> I have what I think is a string from socket.recvfrom(...). I want to > turn it into numbers Hi Frank, If you know how those bytes should be interpreted, you may want to look at the 'struct' module to destructure them back into integers: http://www.python.org/doc/lib/module-struct.html

Re: [Tutor] os.access vs os.path.isfile

2005-08-20 Thread Danny Yoo
> os.access is better/fast that os.path.isfile for checking if exist a file? I don't think we should judge this primarily as a matter of speed, but a matter of functionality. If we do something like: os.access(pathname, os.F_OK) this will tell us if a path name exists. But note that this

Re: [Tutor] Network Tutorials

2005-08-21 Thread Danny Yoo
On Sun, 21 Aug 2005, John Walton wrote: > Hello, everyone. I just began school, and they already assigned us > science fair. Since I'm in 8th grade, I get to do demonstrations for > our projects. > > I'm probably going to demonstrate Python's networking capabilities by > writing a simple insta

Re: [Tutor] how to make a script do two things at once.

2005-08-21 Thread Danny Yoo
On Sun, 21 Aug 2005, nephish wrote: > i have a simple question about getting a script to do > two things at once. Hi Shawn, It sounds like you may want to try threading. Here you go: http://www.python.org/doc/lib/module-threading.html Aahz has written a tutorial about Threads here:

Re: [Tutor] Importing serial module

2005-08-21 Thread Danny Yoo
On Mon, 22 Aug 2005, Hans Dushanthakumar wrote: > 1) I downloaded the python serial port module (pyserial-2.2.win32.exe) > from http://sourceforge.net/project/showfiles.php?group_id=46487 > And installed it on my Win XP PC. >However, when I try to import the module, I get the foll: error > >

Re: [Tutor] Writing to XML file with minidom

2005-08-22 Thread Danny Yoo
> """ Parse the xml file """ > xmlDocument = minidom.parse(self.configFile) [code cut] > Now I want to change a string that a retrieved from the file and write > it back to where it was. So, I get something, change it and write it > back. > > How do I put the new string in the place

Re: [Tutor] nested loops

2005-08-22 Thread Danny Yoo
On Mon, 22 Aug 2005, Kent Johnson wrote: > > Is there any way more efficient for run a nested loop? > > > > -- > > for a in list_a: > > for b in list_b: > > if a == b: break Hi Jonas, Depends on what we're trying to do. Is it necessary to have a nested loop here? What kind of

Re: [Tutor] Thread deamon

2005-08-22 Thread Danny Yoo
On Mon, 22 Aug 2005, Jorge Louis de Castro wrote: > Anyone knows how to setDaemon(True) or pass it as an argument to > start_new_thread() with the code snippet below? > > server.listen(1) > thread.start_new_thread(run_server,(server,)) > > Otherwise the thread stops running when I close the teln

Re: [Tutor] Writing to text files

2005-08-22 Thread Danny Yoo
> It's actually fairly simply and straight forward... Here's how to do > it: (I haven't officially tested this code for bugs, but I believe it > is correct.) > > file = open("datafile.txt", "r") > filedata = file.read() > file.close() > > newLine = "Your new line of data with the time stamp goe

Re: [Tutor] Need Help on Assignment

2005-08-23 Thread Danny Yoo
On Tue, 23 Aug 2005, Tom Strickland wrote: > I have imported a text file consisting of lines of csv. [problem statement cut] > Python doesn't like the ways I've attempted to make these assignments. Do you mind if you show us what you've tried so far? Also, show us the exact syntax error and

Re: [Tutor] Need Help on Assignment (fwd)

2005-08-23 Thread Danny Yoo
[Forwarding to Tutor; next time, please also use Reply-to-All in your email client. That way, everyone can help.] -- Forwarded message -- Date: Tue, 23 Aug 2005 17:19:43 -0500 From: Tom Strickland <[EMAIL PROTECTED]> To: Danny Yoo <[EMAIL PROTECTED]> Subject: Re:

[Tutor] IndexError and appending to lists [Was: Re: Need Help on Assignment]

2005-08-23 Thread Danny Yoo
Hi Tom, Before we continue: it looks like you're starting to learn Python. Have you gone through one of the tutorials here? http://wiki.python.org/moin/BeginnersGuide/NonProgrammers Alan Gauld's tutorial is especially nice, but all of the tutorials there should be useful. If you go throug

Re: [Tutor] IndexError and appending to lists [Was: Re: Need Help on Assignment]

2005-08-23 Thread Danny Yoo
[Danny] > >Anyway, this doesn't answer the problem: how do we add elements to a > >list? In Python, we can accumulate elements in a list by append()ing: [code cut] [Tom] > So, for example, would I use the following in my "while" loop: > > date.append(T[N][0]) > > Before th

Re: [Tutor] IndexError and appending to lists [Was: Re: Need Help on Assignment]

2005-08-23 Thread Danny Yoo
On Tue, 23 Aug 2005, Tom Strickland wrote: > I changed the program in accordance with your advice and it now runs > perfectly!!! Hi Tom, That's very good to hear; glad it's working now. If you don't mind, can you post up what you have now? I left out some other suggestions to the program bec

Re: [Tutor] IndexError and appending to lists [Was: Re: Need Help on Assignment]

2005-08-23 Thread Danny Yoo
> input = open('/home/tom/Python/Input/SPY3.txt', 'r') > N=0 > s = 'boo' > date =[] > T = [0,0,0,0,0,0] #don't know why this is necessary ^ Ok, let's talk about that comment there. Why six zeros? __

Re: [Tutor] try except continue (fwd)

2005-08-24 Thread Danny Yoo
-- Forwarded message -- Date: Wed, 24 Aug 2005 11:24:44 -0700 From: [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: Danny Yoo <[EMAIL PROTECTED]> Subject: Re: [Tutor] try except continue hi Danny, I finally had a chance to review your explanation of continue you wrote a

Re: [Tutor] Importing modules/classes

2005-08-24 Thread Danny Yoo
> class dummy_class: > def __init__(self): > print "__init__" > > def run(self): > print "run" > > > Now, I have another file test_dummy.py, which only has the foll 2 lines > > import dummy_class > d=dummy_class() Hi Hans, In Python, modules are containers. They can co

Re: [Tutor] Beautiful Soup / Unicode problem?

2005-08-25 Thread Danny Yoo
On Thu, 25 Aug 2005, grouchy wrote: > >>>file = urllib.urlopen("http://www.google.com/search?q=beautifulsoup";) > >>>file = file.read().decode("utf-8") > >>>soup = BeautifulSoup(file) > >>>results = soup('p','g') > >>> x = results[1].a.renderContents() > >>> type(x) > > >>> print x > Matt Croy

Re: [Tutor] Beautiful Soup / Unicode problem?

2005-08-26 Thread Danny Yoo
> Here you go: > > >>> import types > >>> print types.StringTypes > (, ) > >>> import sys > >>> print sys.version > 2.3.4 (#2, May 29 2004, 03:31:27) > [GCC 3.3.3 (Debian 20040417)] > >>> print type(u'hello' in types.StringTypes > True > >>>sys.getdefaultencoding() > 'ascii' [CCing Leonard Richa

Re: [Tutor] Strange XP stdin behaviour.

2005-08-26 Thread Danny Yoo
> C:\somepath> intest.py < in.txt > > There is no output! > In fact, I get an error: > > E:\PROJECTS\Python>intest.py < in.txt > Traceback (most recent call last): > File "E:\PROJECTS\Python\intest.py", line 2, in ? > inp = raw_input() > EOFError: EOF when reading a line Hi Alan, Yes, this

Re: [Tutor] hi

2005-08-29 Thread Danny Yoo
On Sat, 27 Aug 2005, bobby arocha wrote: > hello i am new to python very new as in my first time ever using it and > no experience in programming at all and i woul dliek some help to > understand how th eprogram works and how to use pythin to thelimits of > its capabilitys and i woul dlike some

Re: [Tutor] Writing to XML file with minidom

2005-08-31 Thread Danny Yoo
> > One snag that I found is that the des encryption that I used for the > > data that is written back, it is not parsed correctly when the file is > > read again with the new data in it. There is non-printable characters > > or non-ascii chars in that gives errors from expat when the contents > >

Re: [Tutor] PYTHON????

2005-08-31 Thread Danny Yoo
On Mon, 29 Aug 2005 [EMAIL PROTECTED] wrote: > How does a calculator multiply? I want to create a computer software > that can multiply. How do I program the computer to multiply? Hello, Have you had a chance to look at: http://wiki.python.org/moin/BeginnersGuide/NonProgrammers There ar

Re: [Tutor] Popen and Prompting

2005-08-31 Thread Danny Yoo
On Tue, 30 Aug 2005, Faulconer, Steven M. wrote: > Been digging through the web and the archives for the tutor list and > can't seem to locate an answer to my question. It is probably out there, > but my searching skills are failing me. I recently wrote a GUI for > several command line programs

Re: [Tutor] Closing SimpleXMLRPCServer properly

2005-08-31 Thread Danny Yoo
> class StoppableXMLRPCServer(SimpleXMLRPCServer.SimpleXMLRPCServer): > def serve_forever(self): > """to stop this server: register a function in the class > that uses it which sets server.stop to True.""" > self.stop = False > while not self.stop: > self.handle_request() > > Here's the code where

Re: [Tutor] How to save updated values in a program?

2005-09-01 Thread Danny Yoo
On Thu, 1 Sep 2005, Nathan Pinno wrote: > How do I save updated values in a program when it quits? Are the new > values automatically saved, or do I have to code it in to the program in > order to save the updated values? Hi Nathan, We'll have to do something explicit to save them. In the pas

Re: [Tutor] TEST to see if this gets out

2005-09-02 Thread Danny Yoo
On Fri, 2 Sep 2005, Jack Anema wrote: > TEST Hi Jack, We're here. Do you have a question about learning Python? ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Python2.3.4, PySqlite2 and Solaris

2005-09-02 Thread Danny Yoo
> Python 2.3.4 (#1, Aug 23 2004, 13:59:34) > [GCC 3.2.3] on sunos5 > Type "help", "copyright", "credits" or "license" for more information. > >>> from pysqlite2 import dbapi2 as sqlite > Traceback (most recent call last): > File "", line 1, in ? > File "/home/rbnewby/lib/python/pysqlite2/dbap

Re: [Tutor] convert binary to ascii

2005-09-02 Thread Danny Yoo
On Fri, 2 Sep 2005, Servando Garcia wrote: > Here is my question : sam in binary is 01110011 0111 01101101. >if given 01110011 0111 01101101 how would I go back to ascii. Hi Servando: If we have strings of ones and zeros, we can turn those into numbers by using the int() fun

Re: [Tutor] mod_python.publisher

2005-09-02 Thread Danny Yoo
On Fri, 2 Sep 2005, Scott Oertel wrote: > Scott Oertel wrote: > > > I'm having an issue with mod_python.publisher, > > > > supposedly i should be able to just place this code > > > > def index(): > >return "This is only a test." > > > > into test.py and when placed into my browser it should

Re: [Tutor] re.findall(), but with overlaps?

2005-09-03 Thread Danny Yoo
> I may put in an enhancement request to change the name of re.findall to > re.findsome. Hi Terry, A typical use of regular expressions is to break text into a sequence of non-overlapping tokens. There's nothing that technically stops us from applying the theory of regular expressions to get o

[Tutor] CREATING A PR.EXE FROM A PR.PY (fwd)

2005-09-04 Thread Danny Yoo
http://www.gweep.ca/~edmonds/usenet/ml-etiquette.html for more explanation of this.] -- Forwarded message -- Date: Sun, 4 Sep 2005 13:38:58 -0500 From: Jack Anema <[EMAIL PROTECTED]> To: Danny Yoo <[EMAIL PROTECTED]> Cc: [EMAIL PROTECTED] Subject: CREATING A PR.EXE FR

Re: [Tutor] mod_python on OS X

2005-09-05 Thread Danny Yoo
On Mon, 5 Sep 2005, Jan Eden wrote: > I just tried installing mod_python on OS X (10.3.9). Installation went > fine, and Apache starts up without complaining: > > Apache/2.0.53 (Unix) DAV/2 PHP/5.0.1 mod_python/3.1.4 Python/2.4.1 > mod_perl/2.0.1 Perl/v5.8.1 configured -- resuming normal operati

Re: [Tutor] General Information Request

2005-09-06 Thread Danny Yoo
On Tue, 6 Sep 2005, Lane, Frank L wrote: > I found a really neat technique on the web using a built in called > "apply", with it you can do struct.pack() using an array for the values. > I can't find the technique in the release documentation and what's there > says apply is deprecated, use the

Re: [Tutor] Combining dictionaries

2005-09-06 Thread Danny Yoo
> No, that's not what he wants. > > He wants c = a + b to work when a and b are dictionaries. > > Why is Python broken in such an obvious way? Hi Mike: It might not be obvious. If a and b overlap so that they share keys, then we might have the following situation: c1 = a + b c2 = b + a

Re: [Tutor] Combining dictionaries

2005-09-06 Thread Danny Yoo
> >> He wants c = a + b to work when a and b are dictionaries. > >> > >> Why is Python broken in such an obvious way? > > > It might not be obvious. If a and b overlap so that they share keys, > > then we might have the following situation: > > I did consider that, but of course, "update" has to

Re: [Tutor] how to create a generic instance of an object?

2005-09-06 Thread Danny Yoo
> Perhaps I'm taking the wrong approach here with the Asset/AssetType > base-class/sub-class organization; it's beginning to feel that way. > > I've tried something like this: > > > class Asset: pass > > > class Foo(Asset): pass > > > from asset import Asset > from foo import Foo > > klass = '

[Tutor] Literal string concatenation (Was: Re: Combining dictionaries)

2005-09-06 Thread Danny Yoo
On Tue, 6 Sep 2005, bob wrote: > At 04:14 PM 9/6/2005, Mike Cheponis wrote: > >On Tue, 6 Sep 2005, Danny Yoo wrote:[snip] > > > >How can I actively help fix these Python bugs? > > I am concerned when you use the term "bugs". The behaviors you describe &g

Re: [Tutor] smtp error

2005-09-06 Thread Danny Yoo
On Tue, 6 Sep 2005, Shitiz Bansal wrote: > does this error make sense to anyone? > > Traceback (most recent call last): > File "C:/Documents and > Settings/Administrator/Desktop/lkp.py", line 46, in > -toplevel- > s.sendmail(msg['From'], i, msg.as_string()) > File "C:\Python24\lib\smtpli

Re: [Tutor] input/output redirection

2005-09-08 Thread Danny Yoo
On Thu, 8 Sep 2005, Lane, Frank L wrote: > I wanted to take the stdout of a process and redirect it to stdin of a > python script, then after playing with the input in the script I want to > send it back to stdout (all of this to be done while the original > process runs happily along). I can't

Re: [Tutor] making a table

2005-09-08 Thread Danny Yoo
On Thu, 8 Sep 2005 [EMAIL PROTECTED] wrote: > I would like to construct a table for my program but it does not seem to > be coming out evenly. Could someone please let me know what to do so > that everything will work out correctly? Hello, I'll assume for the moment that you want, in your prin

Re: [Tutor] directory recursion

2005-09-09 Thread Danny Yoo
On Fri, 9 Sep 2005, Rob Andrews wrote: > I should already know this, and probably once did, but have never had > a real world use for it until now. > > What's a nice, clean way to recursively scan through directories with > an arbitrary number of subdirectories? Hi Rob, You may want to look at

Re: [Tutor] mamelauncher

2005-09-09 Thread Danny Yoo
On Fri, 9 Sep 2005, Max Russell wrote: > I've been working on this for ages and am having real problems with > getting the wiring for a selected game to launch when I click OK. > > I haven't added my error handling yet. [code cut] Hi Max, Hmmm... Out of curiosity, what happens if you try doi

Re: [Tutor] mamelauncher

2005-09-12 Thread Danny Yoo
On Mon, 12 Sep 2005, Alan G wrote: > > def run_mame_selection(selection): > >os.system("C:\\mame096b\\mame.exe"+""+selection) Hi Max, If you're getting really stuck here, skip below for a hint. Hint: in the defintion of run_mame_selection, there's some string concatenation going on he

Re: [Tutor] Where did those spaces come from?

2005-09-12 Thread Danny Yoo
On Mon, 12 Sep 2005, Tom Tucker wrote: > Good evening! The goal is to parse a simple file and grab column one. > Then print each value horizontally separated by a comma. Why is Python > adding a space padding between each value? Please see below. Thanks > ahead of time. Hi Tom, The 'print' s

Re: [Tutor] mamelauncher (fwd)

2005-09-13 Thread Danny Yoo
Hi Max, [Keeping tutor@python.org in CC. Please do not send replies only to me: make sure tutor@python.org is being included in the reply.] [Danny] >> Hint: in the defintion of run_mame_selection, there's some string >> concatenation going on here: >> >> ## >> def run_mame_selection(selec

Re: [Tutor] mamelauncher (fwd)

2005-09-13 Thread Danny Yoo
> Also, does this work? > > ## > def run_packman(): > os.system("C:\\mame096b\\mame.exe packman") ^^^ Gaaa. My apologies: that was a typo. Correct this (and other places where I wrote 'packman') with whatever name you use to explicitly tell MAM

Re: [Tutor] GETTING AN _.EXE VERSION OF _.PY program to run on a machine that does not have Python installed on it.

2005-09-13 Thread Danny Yoo
On Mon, 12 Sep 2005, JackA wrote: > I am attaching a word document copy of this EMail which might be easier > to read and follow if your EMail window rearanges things to much. Hi Jack, Actually, please don't do that. *grin* Word documents are actually not really usable in a programming langu

Re: [Tutor] mamelauncher (fwd)

2005-09-13 Thread Danny Yoo
On Tue, 13 Sep 2005, Max Russell wrote: > There actually seems to be a bit of a problem in the interaction with > the system when it launches mame. > > If I run this: > > import os > > def run_mame_selection(selection): > os.system("C:\\mame096b\\mame.exe"+ selection) > > #main > selection =

[Tutor] Python as operating system?

2005-09-13 Thread Danny Yoo
> Python is theoretically capable of being used to write an OS, but that > is an exercise that is probably left to theory. There are a lot of good > OS'es out there that would undoubtedly perform much better than a > PythonOS ever could. That doesn't mean it wouldn't be cool, though. :-) I haven

Re: [Tutor] GETTING AN _.EXE VERSION OF _.PY program to run on a machine that does not have Python installed on it. (fwd)

2005-09-15 Thread Danny Yoo
-- Forwarded message -- Date: Wed, 14 Sep 2005 21:33:08 -0500 From: JackA <[EMAIL PROTECTED]> To: Danny Yoo <[EMAIL PROTECTED]> Subject: Re: [Tutor] GETTING AN _.EXE VERSION OF _.PY program to run on a machine that does not have Python installed on it. Sorry for

Re: [Tutor] Please help with comparision in range of numbers

2005-09-15 Thread Danny Yoo
> 1427021_s_at chr7:102786983-102794499(+) > 1452285_a_at chr7:102786983-102794499(+) > 1445553_atchr7:102848766-102910961(-) > 1420925_atchr7:102863841-102887410(+) > 1450041_a_at chr7:102863841-102887410(+) > 1447553_x_at chr7:102899711-102899

Re: [Tutor] Do I have to include certain items in the setup.py file?

2005-09-16 Thread Danny Yoo
On Fri, 16 Sep 2005, Nathan Pinno wrote: > I was curious about what I have to include in the setup.py file. Do I > have to include such statements as "import random" if the code uses > import random and the random functions in its code for example? Hi Nathan, Each module is responsible for its

Re: [Tutor] Multiple buttons, One callback

2005-09-16 Thread Danny Yoo
> I've been able to bind each button to the same callback function (that > part's trivial) but what hasn't been trival is determining which button > was clicked and, from this information, gathering the correct datum from > the list of StringVars which make up the first label text. Hi David, I

Re: [Tutor] Do I have to include certain items in the setup.py file?

2005-09-16 Thread Danny Yoo
On Fri, 16 Sep 2005, Nathan Pinno wrote: > It sure does. Thanks Danny. One final question: Is it possible to write > one setup.py and use it for multiple Python programs? Just to make sure, we are talking about the Distutils setup.py that's used to build distributions of Python applications, ri

Re: [Tutor] ElementTree: finding a tag with specific attribute

2005-09-16 Thread Danny Yoo
> If you look at the list, for a while the functions are being called 777 > times. This is probably the number of start tags in the document. But > when you get to recursiveChildGenerator(), all of a sudden it is called > 898655 times, over 1000 times for each call to _fetch()! This is a > staggeri

Re: [Tutor] Why won't it enter the quiz?

2005-09-16 Thread Danny Yoo
> I've got this program I've written that should give an addition quiz, > except it never enters the quiz. How do I make it enter the quiz? Hi Nathan, Let's look at a small snippet of the code. > q = random.choice(range(15,31)) > cq = 1 What does 'q' stand for? What does 'cq' stand

Re: [Tutor] Why won't it enter the quiz?

2005-09-17 Thread Danny Yoo
On Fri, 16 Sep 2005, Nathan Pinno wrote: > cq is for "current question" and q is for "question" > therefore cq >= q should be correct most of the time Are you sure? Try specific values of current_question and question: don't just assume that it'll work: try running through the numbers. Rememb

Re: [Tutor] Multiple buttons, One callback (fwd)

2005-09-17 Thread Danny Yoo
ROTECTED]> To: Danny Yoo <[EMAIL PROTECTED]> Subject: Re: [Tutor] Multiple buttons, One callback Actually, that makes a lot of sense. Feel free to get back to me at your leisure, I'll be working on this problem some today so I might have solved it by the time you respond, but if not t

Re: [Tutor] Why won't it enter the quiz?

2005-09-17 Thread Danny Yoo
On Sat, 17 Sep 2005, Nathan Pinno wrote: > I can see that I was wrong. I was tired, and I don't always think too > smart. It should be cq <= q. :) Hi Nathan, Yes. Here are some general tips about debugging while loops. If we have a while loop: while some_condition: ... and if

Re: [Tutor] MySQLdb error - PLEASE SAVE ME!

2005-09-17 Thread Danny Yoo
On Sat, 17 Sep 2005, Ed Hotchkiss wrote: > Ok. I am trying to read a csv file with three strings separated by > commas. I am trying to insert them into a MySQL DB online. MySQLdb is > installed, no problems. > > I think that I am having some kind of error with my csv going into the > fields and

Re: [Tutor] Multiple buttons, One callback (fwd)

2005-09-17 Thread Danny Yoo
> So, just to see if I understand you, I can create a function that > creates the thunk callback and returns it. This returned thunk callback > (is that a technical term or one of your own, by the way?) can then be > bound as the button's call back and will be able to remember the > parameters pa

Re: [Tutor] How do you organize code snippets?

2005-09-18 Thread Danny Yoo
On Sun, 18 Sep 2005, List wrote: > The subject pretty much says it. I tend to clip and save snippets from > various lists for later reference. I save each in a separate text file > more or less named appropriately (or so I think at the time), but I've > ended up with a mess of files in a snippet

Re: [Tutor] pychart and debian

2005-09-18 Thread Danny Yoo
On Sun, 18 Sep 2005, nephish wrote: > anyone have luck getting pychart installed on debian ? there is no > debian package for it (that i have found thus far) and i need something > that will allow me to place some simple x, y plots on a chart in pygtk. Hi sk, Ah, found it. It's in the 'testin

Re: [Tutor] tuples and mysqldb tables

2005-09-18 Thread Danny Yoo
Hi Ed, Let's look at one of your questions: > How do I use a loops to iterate through the nested tuple Let's separate this apart from the SQL stuff for the moment. Are you familiar with Python's for loop, and how it can work on sequences? For example: ## >>> authors = ['fowler', 'lau',

Re: [Tutor] Best Encryption for Python Client/Server

2005-09-18 Thread Danny Yoo
On Sun, 18 Sep 2005, Ed Hotchkiss wrote: > Let us say that I am trying to create a very small and simple private > network/connection between several scripts on different machines, to > communicate instructions/data/files etc. to each other over the net. Is > SSL the best method? Any recommendat

Re: [Tutor] pychart and debian

2005-09-18 Thread Danny Yoo
> ok, got the package installed, but it seems to not be working, or the > examples are messed up. > here is the source > > from pychart import * > theme.get_options() > data = [["Jan", 10], ["Feb", 22], ["Mar", 30]] > > ar = area.T(x_coord = category_coord.T(data, 0), > y_range = (0, No

Re: [Tutor] tuples and mysqldb tables

2005-09-18 Thread Danny Yoo
> def run(self): > try: > ss = socket.socket(socket.AF_INET, socket.SOCK_STREAM) > ss.connect((ip, port_counter)) > print "%s | %d OPEN" % (ip, port_counter) > ss.close() > except: pass Hi Ed, Yikes. Don't do that. *grin* By "that",

Re: [Tutor] tuples and mysqldb tables (fwd)

2005-09-19 Thread Danny Yoo
t;[EMAIL PROTECTED]> To: Danny Yoo <[EMAIL PROTECTED]> Subject: Re: [Tutor] tuples and mysqldb tables Thanks for the debugging help :P - I've edited the error handling line, and defined the port_counter above, but I am still not getting any output. I have inserted print "scanned: ",p

Re: [Tutor] tuples and mysqldb tables (fwd)

2005-09-19 Thread Danny Yoo
> Thanks for the debugging help :P - I've edited the error handling line, and > defined the port_counter above, but I am still not getting any output. I > have inserted print "scanned: ",port_counter,"\n" > into the thread, so that should at least print to screen each time the > thread is ran, re

[Tutor] OOP fundamentals

2005-09-19 Thread Danny Yoo
On Mon, 19 Sep 2005, Ed Hotchkiss wrote: > Thanks for the link! It is EXACTLY what I have been looking for. When I > used to use Flash a bit, and did some actionscript they had a similiar > setup for OOP (Do all languages use OOP so similiarly?) which I never > learned. Hi Ed, I believe that

Re: [Tutor] OOP fundamentals

2005-09-19 Thread Danny Yoo
On Mon, 19 Sep 2005, Ed Hotchkiss wrote: > Thanks Danny! Tommorrow I am off to get "Programming for Python, 2nd > edition" and learn everything - all of it, before I even bother with > Sockets. Hi Ed, I'd disrecommend Programming Python if you're a beginner. Programming Python is really more

Re: [Tutor] problem with matplot

2005-09-20 Thread Danny Yoo
> anyone have any luck getting up and running with matplot-lib on debian? > from the website, i followed the instructions to get it with apt. but > something is messed up in the dependencies. Check with the Debian folks about this one; the problem you're running into looks really specific to the

Re: [Tutor] problem with matplot

2005-09-20 Thread Danny Yoo
> >Check with the Debian folks about this one; the problem you're running > >into looks really specific to the way Debian has packaged libstdc++6. > >This topic isn't really one that folks on Tutor will necessarily have > >competence in. Instead, try the debian-python mailing list: > > > >http

Re: [Tutor] Calling Modules in ActiveState 2.4

2005-09-21 Thread Danny Yoo
Hi Bob, Bob, when you see these kinds of errors, please don't paraphrase the error message. You mentioned: > > When I call: > > import sys > > sys.exit() > > I get a traceback error saying it needs more input Instead of putting the error in your own, just copy-and-paste the error. Don't worry

Re: [Tutor] Calling Modules in ActiveState 2.4

2005-09-21 Thread Danny Yoo
On Wed, 21 Sep 2005, Bob Nienhuis wrote: > When I do: > import sys > sys.exit(0) > I get: > Traceback (most recent call last): > File "C:\Python24\Lib\site-packages\pythonwin\pywin\scintilla\bindings.py", > line 141, in fire > rc = apply(binding.handler, args) > File "C:\Python24\Lib\site-packag

Re: [Tutor] Python DB

2005-09-22 Thread Danny Yoo
On Thu, 22 Sep 2005, Matt Williams wrote: > I've been looking for a simple python based DB for a fairly simple app. > Only a single user, single access needed, but with a dynamic structure > (which needs to be extensible very easily). Hi Matt, What kind of data are you trying to represent? An

Re: [Tutor] USB Capture Image WebCAM

2005-09-22 Thread Danny Yoo
On Thu, 22 Sep 2005, Alberto Troiano wrote: > For those who doesn't know what is it its a program that captures images > from your USB WebCAM and saves them to send via FTP. > > Anyway, getting to the point I don't know how to get the video from the > camara to watch it inside a GUI made in Pyth

Re: [Tutor] Python DB

2005-09-22 Thread Danny Yoo
On Thu, 22 Sep 2005, Matt Williams wrote: > The problem (I have) with SQL-type DB is that I cannot be sure ahead of > time of the exact data structure. The DB will be about patients, who > have diseases, and also have treatments.Clearly, I can't specify now > the exact structure of the table

Re: [Tutor] FW: Re: USB Capture Image WebCAM

2005-09-22 Thread Danny Yoo
> I have downloaded videoCapture but I can't make it run. This is the error I > get when I try run the example > > Traceback (most recent call last): > File "C:\Documents and Settings\Daron > Malakian\Desktop\VideoCapture-0.9\Tools\webcam-uploader\webcam-uploader.py", > line 130, in ? > cam

Re: [Tutor] Diamond Equivalent

2005-09-22 Thread Danny Yoo
On Thu, 22 Sep 2005 [EMAIL PROTECTED] wrote: > I am coming to Python from Perl. Does Python have anything like the > diamond operator found in Perl? Hi Kim, According to 'perldoc perlop': """ The null filehandle <> is special: it can be used to emulate the behavior of sed and a

Re: [Tutor] how to insert a string?

2005-09-22 Thread Danny Yoo
On Thu, 22 Sep 2005 [EMAIL PROTECTED] wrote: > I would like to insert a string into the following program to simplify > the program. Any suggestions on how I might do so? Hello, It's a little unclear what you're asking when you mention "insert a string": usually, inserting anything into a prog

Re: [Tutor] How to install python on to a remote apache server

2005-09-22 Thread Danny Yoo
> I'd like to write some internet applications but I don't know how to > test them unless I have python on my server. However, It's running > Apache 1.3.3 and it's a remote one (I'm in the Americas and it's in > Europe) so I don't know how to access it. I also would like to know what > platform o

Re: [Tutor] Stupid newbie question

2005-09-23 Thread Danny Yoo
On Fri, 23 Sep 2005, Valone, Toren W. wrote: > I am trying to noodle thru classes with python and I built the following > class. Hi Toren, Ah. Check your indentation: it appears that the definition of getday() is within the body of the class initializer __init__(). What ends up happening is

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

2005-09-23 Thread Danny Yoo
On Fri, 23 Sep 2005, Nathan Pinno wrote: > I need help with pi and the math module. I had import math at the top of > a program, but when it came to diameter*pi, it said that pi was not > defined. Hi Nathan, Python's module import will not automatically pull all the names in a module and dum

Re: [Tutor] printing an acronym

2005-09-24 Thread Danny Yoo
On Sat, 24 Sep 2005 [EMAIL PROTECTED] wrote: > How could I get the following to print out an acronym for each phrase > entered such as if I entered random access memory it word print out RAM? Hello, Just out of curiosity, are you already familiar with Python's "lists"? If so, then you might

Re: [Tutor] (no subject)

2005-09-24 Thread Danny Yoo
On Sat, 24 Sep 2005 [EMAIL PROTECTED] wrote: > How would I get the following program to accept inputs of exam scores > from 0-100 with A being 100-90, B being 89-80, C being 79-70, D being > 69-60, and F being everything less than 60? Hello, Are you familiar with "if/elif/else"? These "contr

Re: [Tutor] printing an acronym (fwd)

2005-09-26 Thread Danny Yoo
Forwarding to tutor -- Forwarded message -- Date: Mon, 26 Sep 2005 08:32:02 -0500 From: Jason Massey <[EMAIL PROTECTED]> To: Danny Yoo <[EMAIL PROTECTED]> Subject: Re: [Tutor] printing an acronym Something like this: def acro(a): ... b = a.split() ... c = &q

Re: [Tutor] help getting acronym to print?

2005-09-26 Thread Danny Yoo
> > How could I get the following program to output UDP from the user > > entering user datagram protcol or IP if internet protocla was entered? Wait a second. This looks exactly like this question from just a day ago: http://mail.python.org/pipermail/tutor/2005-September/041639.html The a

Re: [Tutor] encode question!

2005-09-26 Thread Danny Yoo
On Tue, 27 Sep 2005, [GB2312] ��ʯ wrote: > I am trying to write a stript that extract jpg files > from a html I had downloaded.I encounter a problem with > a Big5 charset html file.Big5 used in Hongkong ans Taiwan. > In this html file there's a jpg names "xvg_h%202.jpg" in vi ,the tag

<    1   2   3   4   5   6   7   8   9   10   >