From piercew@netscape.net Tue Feb 1 01:12:31 2000 From: piercew@netscape.net (Wayne) Date: 31 Jan 00 17:12:31 PST Subject: [Tutor] Re: Python Tutorial probs... Message-ID: <20000201011231.26952.qmail@wwcst269.netaddress.usa.net> Daniel, > Hello Hi! > >>> tax =3D3D 17.5 / 100 > >>> price =3D3D 3.50 > >>> price * tax=3D20 > which should return > 0.6125=3D20 > and it dose but the problem is when it tells me to type in: > >>> price + _ > I get an error message..... here is the hole thing... Unless there is a variable called '_' it can't add them together. It's probably just a typo in the documentation (or it might be a blank space t= hat is part of a link). If you set the value of '_' to something it will add= them properly. > thanks in advance Not a problem. Wayne ____________________________________________________________________ Get your own FREE, personal Netscape WebMail account today at http://webm= ail.netscape.com. From blackgr@alltel.net Tue Feb 1 02:12:47 2000 From: blackgr@alltel.net (Glynn Black) Date: Mon, 31 Jan 2000 21:12:47 -0500 (EST) Subject: [Tutor] Rounding Floating Points Message-ID: I'm looking to round off a floating point number and then convert it to a string. I've accomplished this with the following in Perl: $output_label2_var = sprintf("%.2f", $output_label2_var); but have yet to find any reference to sprintf() in any my Python books/references or any other means of getting the same results for that matter. How would I go about accomplishing this in Python? Glynn Black blackgr@alltel.net From tim_one@email.msn.com Tue Feb 1 01:26:05 2000 From: tim_one@email.msn.com (Tim Peters) Date: Mon, 31 Jan 2000 20:26:05 -0500 Subject: [Tutor] Python totorial problems..... In-Reply-To: <5104D4DBC598D211B5FE0000F8FE7EB202DF6019@mbtlipnt02.btlabs.bt.co.uk> Message-ID: <000501bf6c53$4f3dd180$d709143f@tim> >> and it dose but the problem is when it tells me to type in: >> >>> price + _ >> I get an error message..... here is the hole thing... [alan.gauld@bt.com] > What version of Python do you have, it works for me > with Python 1.5.2 > > But OTOH I was not aware of this '_' trick so it might be > a recent introduction to Python not supported by your version. > > [ I learnt Python on v1.3, and am pretty sure this wasn't > mentioned anywhere in the docs then... ] > > Any of the list guru's like to say when this appeared? The special meaning of "_" in interactive mode has been in Python since the first public release; it has always worked from the command line interpreter, and in IDLE. Dan's(?) problem is most likely that he's using an old version of PythonWin. IIRC, PythonWin's interpreter loop didn't implement this at first. I tried it under PythonWin build 125 and it works fine now. So get a more recent PythonWin, or use IDLE or a straight cmdline interpreter instead. From Moshe Zadka Tue Feb 1 02:10:01 2000 From: Moshe Zadka (Moshe Zadka) Date: Tue, 1 Feb 2000 04:10:01 +0200 (IST) Subject: [Tutor] Python totorial problems..... In-Reply-To: <003601bf6ba3$517003c0$f36299d1@micoks.net> Message-ID: On Sun, 30 Jan 2000, Daniel W Wobker wrote: > Hello, I am using the Python Tutorial Release 1.5.2 When I get to page 9 chapter 3 it tells me to type in in interactive mode > >>> tax = 17.5 / 100 > >>> price = 3.50 > >>> price * tax > which should return > 0.6125 > and it dose but the problem is when it tells me to type in: > >>> price + _ > I get an error message..... here is the hole thing... You're using PythonWin instead of the Python regular interpreter. That said, I think putting the semantics of the command line tutorial is a bit misleading, considering the various interpreters (IDLE, PythonWin and Python) which abound....anyone? -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From Moshe Zadka Tue Feb 1 02:24:06 2000 From: Moshe Zadka (Moshe Zadka) Date: Tue, 1 Feb 2000 04:24:06 +0200 (IST) Subject: [Tutor] Python tutorials In-Reply-To: Message-ID: On Mon, 31 Jan 2000, Oscar Chavez wrote: > Most tutorials' examples are based in operations with strings and > text in general. Are there any Python tutorials that stress its math > capabilities? In particular, I have noticed that there is a limit on > the integers that Python can handle, but I don't know exactly to what > extent this can be modified. To any extent, by using long integers. Try the following function: def fact(n): ret = 1L # a Python long integer is a bignum for i in range(1, n+1): ret = ret * i return ret > I would like to do operations with > matrices, factoring integers and floating point operations. Where > should I look for help on these matters? The Numeric module, which is available now somewhere on sourceforge.net. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From arcege@shore.net Tue Feb 1 03:46:10 2000 From: arcege@shore.net (Michael P. Reilly) Date: Mon, 31 Jan 2000 22:46:10 -0500 (EST) Subject: [Tutor] Rounding Floating Points In-Reply-To: from "Glynn Black" at Jan 31, 2000 09:12:47 PM Message-ID: <200002010346.WAA20990@northshore.shore.net> > I'm looking to round off a floating point number and then convert it to a > string. I've accomplished this with the following in Perl: > > $output_label2_var = sprintf("%.2f", $output_label2_var); > > but have yet to find any reference to sprintf() in any my Python > books/references or any other means of getting the same results for that > matter. How would I go about accomplishing this in Python? It seems you are just concerned with string formatting, not actual rounding in a mathematical sense (which Perl doesn't have per se). There is no sprintf function in Python because Python deals with string formatting as an operator (like "+" or "*"). What you probably want is, resulting in a string instead of a number: output_label2_var = '%.2f' % output_label2_var For example: >>> '%.2f' % 4.506 '4.51' >>> But if you mean rounding functionality (the Perl Cookbook actually has the laughable solution of using sprintf for rounding), then there is a builtin function called round(), which will do this for you: output_label2_var = str(round(output_label2_var, 2)) >>> round(4.506, 2) 4.51 >>> This rounds the value to the given decimal (by hundredths since that is what you specify in your code) and converts the result to a string, which is what the Perl code is doing. Also, if you know a string is a float, you can convert the string with the builtin function: float(), or the string module function atof(). Buf if you were dealing with numbers anyway, then don't worry about using the string formatting or str() and float() functions. Hope this helps, -Arcege -- ------------------------------------------------------------------------ | Michael P. Reilly, Release Engineer | Email: arcege@shore.net | | Salem, Mass. USA 01970 | | ------------------------------------------------------------------------ From oc918@mizzou.edu Tue Feb 1 03:50:09 2000 From: oc918@mizzou.edu (Oscar Chavez) Date: Mon, 31 Jan 2000 21:50:09 -0600 Subject: [Tutor] Python tutorials In-Reply-To: References: Message-ID: At 4:24 AM +0200 2/1/00, Moshe Zadka wrote: >The Numeric module, which is available now somewhere on sourceforge.net. Thank you very much! I found it, and now I have the modules, the documentation, and I also subscribed to the mailing list they have. _____________________________________________________________________ Oscar Chavez You can only find truth with logic if Mathematics Education you have already found truth without it. 104 Stewart Hall University of Missouri The Man who was Orthodox Columbia, MO 65211-6180 G. K. Chesterton oc918@mizzou.edu tel: (573) 882-4521 fax: (573) 882-4481 From johnm88@hotmail.com Tue Feb 1 07:53:43 2000 From: johnm88@hotmail.com (john miner) Date: Mon, 31 Jan 2000 23:53:43 PST Subject: [Tutor] unsubcribe me from your list please Message-ID: <20000201075344.8227.qmail@hotmail.com> unsubcribe me from your list please Thanks. John Miner ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com From alan.gauld@bt.com Tue Feb 1 17:30:30 2000 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Tue, 1 Feb 2000 17:30:30 -0000 Subject: [Tutor] Rounding Floating Points Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB202DF6027@mbtlipnt02.btlabs.bt.co.uk> > $output_label2_var = sprintf("%.2f", $output_label2_var); > > but have yet to find any reference to sprintf() in any my Python Look at "format strings" The equivalent to your sprointf is: "%.2f" % output_label2_var If there are multiple substitutuons you put them in a tuple... Alan G. From ksipos@netaxs.com Tue Feb 1 17:59:38 2000 From: ksipos@netaxs.com (kalak) Date: Tue, 1 Feb 2000 12:59:38 -0500 (EST) Subject: [Tutor] modules available Message-ID: <200002011759.MAA24081@mail.netaxs.com> Please assist me in Python database.. Is there a list of available modules? are any modules available for database manipulation or display. thanks Ken Philadelphia From curtis.larsen@Covance.Com Tue Feb 1 20:34:08 2000 From: curtis.larsen@Covance.Com (Curtis Larsen) Date: Tue, 01 Feb 2000 14:34:08 -0600 Subject: [Tutor] URLLIB Problem Progress(?) Message-ID: I've been continuing to make progress on getting the URLLIB module to work with an HTTP proxy -- my http_proxy environment variable currently reads: "http://proxyname.mydomain.com/" -- and now I get this error when running "urllib.test()": Traceback (innermost last): File "/usr/local/lib/python1.5/urllib.py", line 985, in ? test() File "/usr/local/lib/python1.5/urllib.py", line 964, in test fn, h = urlretrieve(url) File "/usr/local/lib/python1.5/urllib.py", line 69, in urlretrieve return _urlopener.retrieve(url) File "/usr/local/lib/python1.5/urllib.py", line 186, in retrieve fp = self.open(url) File "/usr/local/lib/python1.5/urllib.py", line 159, in open return getattr(self, name)(url) File "/usr/local/lib/python1.5/urllib.py", line 259, in open_http return addinfourl(fp, headers, "http:" + url) TypeError: illegal argument type for built-in operation Is this saying that the "string-constant-plus-'url'-variable" line above is not acceptable? Am I missing something silly? Thanks! Curtis PS: Thanks for the help on my last post about mapping. Curiosity question: Why don't dictionaries use curly braces instead of square brackets for assignation? e.g. instead of . My initial newbie reaction to seeing that is to think the dictionary is a list -- especially when you use curly braces with them otherwise. Just wondering. begin 644 TEXT.htm M/"%$3T-465!%($A434P@4%5"3$E#("(M+R]7,T,O+T141"!(5$U,(#0N,"!4 M7!E/@T*/$U%5$$@8V]N=&5N=#TB35-(5$U,(#4N,#`N,C'D@+2T@;7D@ M:'1T<%]P2!E;G9I61O;6%I;BYC;VTO/"]!/B(@+2T@86YD M(`T*;F]W($D@9V5T('1H:7,@97)R;W(@=VAE;B!R=6YN:6YG(")U71H;VXQ+C4O=7)L;&EB+G!Y(BP@;&EN92`Y.#4L(&EN M(#\\0E(^)FYB71H;VXQ+C4O=7)L;&EB+G!Y(BP@;&EN M92`Y-C0L(&EN(`T*=&5S=#Q"4CXF;F)S<#LF;F)S<#LF;F)S<#L@9FXL(&@@ M/2!U71H;VXQ M+C4O=7)L;&EB+G!Y(BP@;&EN92`Q-3DL(&EN(&]P96X\0E(^)FYB71H;VXQ+C4O=7)L M;&EB+G!Y(BP@;&EN92`R-3DL(&EN(`T*;W!E;E]H='1P/$)2/B9N8G-P.R9N M8G-P.R9N8G-P.R!R971U6EN9R!T:&%T('1H92`B3\\+T1)5CX-"CQ$258^)FYB2`-"G%U97-T:6]N.B!7:'D@9&]N)W0@9&EC=&EO;F%R M:65S('5S92!C=7)L>2!B2!I Does anyone have any examples of this..... especially executing a program that uses switches for example cvs. From gerrit@nl.linux.org Wed Feb 2 14:48:01 2000 From: gerrit@nl.linux.org (Gerrit Holl) Date: Wed, 2 Feb 2000 15:48:01 +0100 Subject: [Tutor] executing a external program In-Reply-To: <00020208185901.02463@localhost.localdomain>; from wking@sheltonbbs.com on Wed, Feb 02, 2000 at 08:18:15AM -0600 References: <00020208185901.02463@localhost.localdomain> Message-ID: <20000202154801.A6010@humbolt.nl.linux.org> Hello, On Wed, Feb 02, 2000 at 08:18:15AM -0600, Mike Partin wrote: > Does anyone have any examples of this..... especially executing a program that > uses switches for example cvs. You can use different functions for that. If you don't need to capture the output but print is as is (like you do when you run a program amnually from the shell), use os.system: Like: os.system("cvs commit -m 'My script changed something' file.c") If you do need to capture the output, you can use os.popen, like: fp = os.popen("cvs commit -m 'My script changed something' file.c") output = fp.read() If you need to capture errors also (likely if you need it for CVS), have a look at the popen2 module. regards, Gerrit. -- -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- From gerrit@nl.linux.org Wed Feb 2 14:51:10 2000 From: gerrit@nl.linux.org (Gerrit Holl) Date: Wed, 2 Feb 2000 15:51:10 +0100 Subject: [Tutor] Rounding Floating Points In-Reply-To: ; from blackgr@alltel.net on Mon, Jan 31, 2000 at 09:12:47PM -0500 References: Message-ID: <20000202155110.A1172@stopcontact.palga.uucp> Glynn Black wrote the following Perl code on 949349567: > $output_label2_var = sprintf("%.2f", $output_label2_var); output_label2_var = round(output_label2_var, 2) regards, Gerrit. -- Please correct any bad Swahili you encounter in my email message! -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- From future@dotstar.net Thu Feb 3 19:10:51 2000 From: future@dotstar.net (Patrick Cooper) Date: Thu, 3 Feb 2000 13:10:51 -0600 Subject: [Tutor] Making Window stay open, Python in Windows Message-ID: <20000203191942148.AAA343@euler.dotstar.net@default> I am trying to learn Python on a Windows 95 system. I'm having the problem that after a type a program and run it the window closes before I can view the output. How can I correct this? From listen@MIDRAS.de Thu Feb 3 20:30:01 2000 From: listen@MIDRAS.de (Jochen Haeberle) Date: Thu, 3 Feb 2000 21:30:01 +0100 Subject: [Tutor] First python-script: a little network client Message-ID: Hi, I m trying to do the first thing in python. I would like to query the OANDA currency server for some exchange rates. I wanted to do a simple script, modify it in some methods and form a class for starters, as I am also beginning with OOP. But I can't get it to work at all! The protocoll specs for fxp is at , case someone's interested. The following script does not produce _anything_ in data :-( Is my simple client so wrong or is there anything with Oanda I am not aware of?? Where can I learn about doing easy network/socks clients? # Currency Fetcher - fetch a conversion unit from OANDA from socket import * HOST = 'www.oanda.com' PORT = 5011 sock = socket(AF_INET, SOCK_STREAM) sock.connect(HOST, PORT) sock.send('fxp/1.1\n') sock.send('Query: quote\n') sock.send('Quotecurrency: SFR\n') sock.send('Basecurrency: EUR\n') print 'Response:' while 1: data = sock.recv(1024) print data if not data: break sock.close Jochen From deirdre@deirdre.net Thu Feb 3 21:57:18 2000 From: deirdre@deirdre.net (Deirdre Saoirse) Date: Thu, 3 Feb 2000 13:57:18 -0800 (PST) Subject: [Tutor] First python-script: a little network client In-Reply-To: Message-ID: On Thu, 3 Feb 2000, Jochen Haeberle wrote: > The protocoll specs for fxp is at > , case someone's > interested. There's several problems with your implementation: 1) each request is supposed to be followed by a carriage return and line feed. This is \r\n, not \n. 2) sock.close should be sock.close() 3) after sending the headers, you have to send a blank line before receiving data. Given the changes mentioned above, the following works though the server doesn't like the currency: from socket import * HOST = 'www.oanda.com' PORT = 5011 sock = socket(AF_INET, SOCK_STREAM) sock.connect(HOST, PORT) sock.send('fxp/1.1\r\n') sock.send('Query: quote\r\n') sock.send('Quotecurrency: SFR\r\n') sock.send('Basecurrency: EUR\r\n') sock.send('\r\n') print 'Response:' while 1: data = sock.recv(1024) print data if not data: break sock.close() -- _Deirdre * http://www.linuxcabal.net * http://www.deirdre.net "Mars has been a tough target" -- Peter G. Neumann, Risks Digest Moderator "That's because the Martians keep shooting things down." -- Harlan Rosenthal , retorting in Risks Digest 20.60 From ivanlan@callware.com Thu Feb 3 21:57:37 2000 From: ivanlan@callware.com (Ivan Van Laningham) Date: Thu, 03 Feb 2000 14:57:37 -0700 Subject: [Tutor] First python-script: a little network client References: Message-ID: <3899F9D1.BADA28FE@callware.com> Hi All-- Jochen Haeberle wrote: > > Hi, > > I m trying to do the first thing in python. I would like to query the > OANDA currency server for some exchange rates. I wanted to do a > simple script, modify it in some methods and form a class for > starters, as I am also beginning with OOP. > > But I can't get it to work at all! > > The protocoll specs for fxp is at > , case someone's > interested. > > The following script does not produce _anything_ in data :-( Is my > simple client so wrong or is there anything with Oanda I am not aware > of?? > > Where can I learn about doing easy network/socks clients? > > # Currency Fetcher - fetch a conversion unit from OANDA > from socket import * > HOST = 'www.oanda.com' > PORT = 5011 > > sock = socket(AF_INET, SOCK_STREAM) > sock.connect(HOST, PORT) > sock.send('fxp/1.1\n') > sock.send('Query: quote\n') > sock.send('Quotecurrency: SFR\n') > sock.send('Basecurrency: EUR\n') > > print 'Response:' > while 1: > data = sock.recv(1024) > print data > if not data: break > sock.close > > Jochen > Hi Jochen-- Your main problem here was that you didn't read the spec closely enough (neither did I at first). It says: "Requests and responses are transmitted using the ASCII character set. Each request consists of a number of lines of text, followed by a single blank line. Each response consists of a number of lines of header text, followed by a single blank line, optionally followed by a number of lines of data, followed by a single blank line. All lines of text (including blank lines) are terminated by the two character sequence . This retains compatibility with the telnet protocol, and telnet can be used to send fxp requests to a server. " You weren't sending \r\n, and you weren't putting everything into one packet. When I ran your test currencies, it complained that it couldn't recognize the quotecurrency. So I changed it: #!/usr/local/bin/python # Currency Fetcher - fetch a conversion unit from OANDA from socket import * HOST = 'www.oanda.com' sv = 5011 sock = socket(AF_INET, SOCK_STREAM) hn = gethostbyname(HOST) print HOST,"IP address",hn sock.connect(hn, sv) i=sock.send('fxp/1.1\r\n' 'Quotecurrency: JPY\r\n' 'Basecurrency: USD\r\n' '\r\n') print "characters sent",i data = sock.recv(1024) print "[%s]"%(data) sock.close() ---------------------------------------------- Note also that the last line you send should be a blank line. Hope this helps, Ivan ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. ivanlan@callware.com ivanlan@home.com http://www.pauahtun.org See also: http://www.foretec.com/python/workshops/1998-11/proceedings.html Army Signal Corps: Cu Chi, Class of '70 Author: Teach Yourself Python in 24 Hours ---------------------------------------------- From nconway@klamath.dyndns.org Thu Feb 3 23:29:31 2000 From: nconway@klamath.dyndns.org (Neil Conway) Date: Thu, 3 Feb 2000 18:29:31 -0500 (EST) Subject: [Tutor] modifying array during 'for' loop? Message-ID: <14490.3931.391688.547421@klamath.dyndns.org> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I was just wondering if it is always okay to modify the array you are looping through with a for loop (i.e. modify the array -during- the for loop). Is it okay to delete the current item from the list? what about items other than the current item? What about append items to the end of the array, or slice the array? I'm dealing with lists (scalar arrays) and tuples. If I'm not being clear, I would be happy to provide example code. While I'm on the topic, I have always assumed that a tuple is marginally more efficient than a list. Is this true? Thanks in advance, Neil - -- Neil Conway Get my GnuPG key from: http://klamath.dyndns.org/mykey.asc In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move. -- Douglas Adams -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.1 (FreeBSD) Comment: Processed by Mailcrypt 3.5.5 and Gnu Privacy Guard iD8DBQE4mg9YgmYXwds8KfwRAtgsAKDICgZWkFUMNAKb0cCAcoqcHgDRuwCgnRgJ gIVPk/Nh892AmY/g1r8n1Ik= =nD34 -----END PGP SIGNATURE----- From chris@abcinteractive.com.au Thu Feb 3 23:59:26 2000 From: chris@abcinteractive.com.au (Chris Carpenter) Date: Fri, 4 Feb 2000 10:59:26 +1100 Subject: [Tutor] Making Window stay open, Python in Windows References: <20000203191942148.AAA343@euler.dotstar.net@default> Message-ID: <004601bf6ea2$b5675a70$0200a8c0@user02> Hi Patrick, i just started learning Python aswell, and ran into the same problem. I was reading a tutorial called "Instant Hacking Learn how to program with Python" by Magnus Lie Hetland and i used this to stop the window dissapearing for a while: #put this at the top of your code from time import sleep #put this at the end of your code, the number in brackets is the seconds the program will sleep, thus leaving the window open on the desktop for that long sleep(30) I'm not sure if thisis the best way to do it,(iv'e only been doing the python thing for about 4 days) But Hey, it worked for me. good luck, Chris Carpenter WebMaster/IT Manager ABC Interactive http://www.abcinteractive.com.au ----- Original Message ----- From: Patrick Cooper To: Sent: Friday, February 04, 2000 6:10 AM Subject: [Tutor] Making Window stay open, Python in Windows > I am trying to learn Python on a Windows 95 system. I'm having the problem > that after a type a program and run it the window closes before I can view > the output. How can I correct this? > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://www.python.org/mailman/listinfo/tutor > > From ivanlan@callware.com Thu Feb 3 23:45:10 2000 From: ivanlan@callware.com (Ivan Van Laningham) Date: Thu, 03 Feb 2000 16:45:10 -0700 Subject: [Tutor] modifying array during 'for' loop? References: <14490.3931.391688.547421@klamath.dyndns.org> Message-ID: <389A1306.6E7602E0@callware.com> Hi All-- Neil Conway wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > I was just wondering if it is always okay to modify the array you are > looping through with a for loop (i.e. modify the array -during- the > for loop). Is it okay to delete the current item from the list? what > about items other than the current item? What about append items to > the end of the array, or slice the array? > > I'm dealing with lists (scalar arrays) and tuples. If I'm not being > clear, I would be happy to provide example code. > > While I'm on the topic, I have always assumed that a tuple is > marginally more efficient than a list. Is this true? > It's never OK. Something like it can be done, but it really is a form of do-it-yourself brain surgery. Never do for i in alist: alist.remove(i) If you *insist* on modifying a list when you're looping on it, then the closest you're going to get to safety (which ain't close) is to peel things off the end of the list and make sure you never access them again. That is, look up the doc for range and get a range that counts backwards. Use the current index to remove or modify the item, as in for i in range(len(alist),-1,-1): del alist[i] Tuples are more efficient in that they're read-only and don't have methods. But the only way to modify them, once created, is to nuke 'em and recreate them. If you're going to modify them, lists are more efficient. -ly y'rs, Ivan ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. ivanlan@callware.com ivanlan@home.com http://www.pauahtun.org See also: http://www.foretec.com/python/workshops/1998-11/proceedings.html Army Signal Corps: Cu Chi, Class of '70 Author: Teach Yourself Python in 24 Hours ---------------------------------------------- From ivanlan@callware.com Fri Feb 4 00:07:02 2000 From: ivanlan@callware.com (Ivan Van Laningham) Date: Thu, 03 Feb 2000 17:07:02 -0700 Subject: [Tutor] Making Window stay open, Python in Windows References: <20000203191942148.AAA343@euler.dotstar.net@default> <004601bf6ea2$b5675a70$0200a8c0@user02> Message-ID: <389A1826.D3A1B1BE@callware.com> Hi All-- Chris Carpenter wrote: > > Hi Patrick, > > i just started learning Python aswell, and ran into the same problem. I was > reading a tutorial called "Instant Hacking Learn how to program with > Python" by Magnus Lie Hetland and i used this to stop the window > dissapearing for a while: > > #put this at the top of your code > from time import sleep > > #put this at the end of your code, the number in brackets is the seconds the > program will sleep, thus leaving the window open on the desktop for that > long > sleep(30) > > I'm not sure if thisis the best way to do it,(iv'e only been doing the > python thing for about 4 days) > But Hey, it worked for me. > It does work, but it's not what you want to do. You have two easy choices: 1) Use the interpreter interactively. Open a DOS box, type "python" and wait for the ">>>" prompt. If it says "program not found", then go to the directory where you have python installed and run it there. Once you have the >>> prompt, type your program in. It will run each line as it gets to it. 2) Type your program into a file. Give the file a .py suffix. Open your DOS box and type "python spam.py" (for instance). Again, if DOS complains that it can't find python, take your .py file and go to the directory where python lives, and type "python spam.py" again. 2) is the most common choice, since it saves your program for later use. I assume that you put your program into a file, and then double-clicked on it from Windows. You're not ready to do that yet--you need to have some knowledge of Tkinter before you can do it correctly. -ly y'rs, Ivan ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. ivanlan@callware.com ivanlan@home.com http://www.pauahtun.org See also: http://www.foretec.com/python/workshops/1998-11/proceedings.html Army Signal Corps: Cu Chi, Class of '70 Author: Teach Yourself Python in 24 Hours ---------------------------------------------- From listen@MIDRAS.de Thu Feb 3 23:32:51 2000 From: listen@MIDRAS.de (Jochen Haeberle) Date: Fri, 4 Feb 2000 00:32:51 +0100 Subject: [Tutor] First python-script: a little network client In-Reply-To: References: Message-ID: Hi Deidre, thanks a lot - that was a fast and perfect help! I was not sure what went wrong at what place, so I did not see the most obvious things! At 13:57 Uhr -0800 03.02.2000, Deirdre Saoirse wrote: >On Thu, 3 Feb 2000, Jochen Haeberle wrote: > > > The protocoll specs for fxp is at > > , case someone's > > interested. > >There's several problems with your implementation: > >1) each request is supposed to be followed by a carriage return and line >feed. This is \r\n, not \n. That' the most problematic error I guess. I thoghut \n is equal to (at least on my Mac) >2) sock.close should be sock.close() sure :-/ >3) after sending the headers, you have to send a blank line before >receiving data. Oh, I overlooked that one. Tell you I read it a dozen times! I guess I would have noticed the last two if I only knew the first :-) Thanks again Jochen From deirdre@deirdre.net Fri Feb 4 00:55:56 2000 From: deirdre@deirdre.net (Deirdre Saoirse) Date: Thu, 3 Feb 2000 16:55:56 -0800 (PST) Subject: [Tutor] First python-script: a little network client In-Reply-To: Message-ID: On Fri, 4 Feb 2000, Jochen Haeberle wrote: > thanks a lot - that was a fast and perfect help! I was not sure what > went wrong at what place, so I did not see the most obvious things! It happens. :) > >1) each request is supposed to be followed by a carriage return and line > >feed. This is \r\n, not \n. > > That' the most problematic error I guess. I thoghut \n is equal to > (at least on my Mac) Macs use \r only. Windows uses \r\n. Unix uses \n only. As a result, most protocols state explicitly what is expected at the end of the line. In some cases if you're writing a server, you want to write something that accepts any of the three conventions (regardless of what is specified). > Thanks again No problem! -- _Deirdre * http://www.linuxcabal.net * http://www.deirdre.net "Mars has been a tough target" -- Peter G. Neumann, Risks Digest Moderator "That's because the Martians keep shooting things down." -- Harlan Rosenthal , retorting in Risks Digest 20.60 From python-tutor@teleo.net Fri Feb 4 01:47:28 2000 From: python-tutor@teleo.net (Patrick Phalen) Date: Thu, 3 Feb 2000 17:47:28 -0800 Subject: [Tutor] Persistent store for a single integer Message-ID: <00020318092404.01083@quadra.teleo.net> I'm writing a CGI script which appends information gathered from a form to a file, which in turn is to be FTP'd to the client once a day for followup. The specification requires that a Unique ID number be incremented and assigned to every person filling out a form, and that ID then is attached to each of the dozen or so individual fields at file writing time. The Unique ID is an integer starting at 1000000 and incrementing by 1 for each new "customer." So, in other words, when I write the data to the file, I need to determine the last-used integer, increment it and concatenate this UniqueID to most of the fields. What is a good persistence model for this integer? A file with a mutex/lock? A pickled numeral? These seem kind of expensive. Naturally, I want to avoid data corruption in the case where many people might access the form at once, take arbitrary time to complete the form, etc., without blocking people for lengthy periods. From listen@MIDRAS.de Fri Feb 4 09:40:48 2000 From: listen@MIDRAS.de (Jochen Haeberle) Date: Fri, 4 Feb 2000 10:40:48 +0100 Subject: [Tutor] First python-script: a little network client In-Reply-To: References: Message-ID: Hi again, my little currency script now happily runs along. The response comes very quickly but the client sits and waits for a rather long time until the connection gets closed or there's some sort of timeout I presume. I am doing this on a Mac, where threading is not available and therefore the socket-connection takes up all processor time not allowing program switvhing. Therefore the additional time for waiting for the timeout is rather bad. I looked through some of the example scripts for socket clients but they all do it about the same. Is there another way for collecting the data sent to a socket or to learn about the stop of a connection that might help? This is how I am doing it now (taken from one of the demos and/or the library reference from Guido. Is this general the way python does this or is it Mac specific? print 'Response:' while 1: data = sock.recv(1024) print data if not data: break sock.close() Jochen From steve@spvi.com Fri Feb 4 11:06:39 2000 From: steve@spvi.com (Steve Spicklemire) Date: Fri, 4 Feb 2000 06:06:39 -0500 (EST) Subject: [Tutor] First python-script: a little network client In-Reply-To: (message from Jochen Haeberle on Fri, 4 Feb 2000 10:40:48 +0100) References: Message-ID: <200002041106.GAA28347@acer.spvi.com> Hi Jochen, I think that 'select' does work on the mac (see medusa) so you might look into that. -steve >>>>> "Jochen" == Jochen Haeberle writes: Jochen> Hi again, Jochen> my little currency script now happily runs along. The Jochen> response comes very quickly but the client sits and waits Jochen> for a rather long time until the connection gets closed or Jochen> there's some sort of timeout I presume. Jochen> I am doing this on a Mac, where threading is not available Jochen> and therefore the socket-connection takes up all processor Jochen> time not allowing program switvhing. Jochen> Therefore the additional time for waiting for the timeout Jochen> is rather bad. I looked through some of the example Jochen> scripts for socket clients but they all do it about the Jochen> same. Jochen> Is there another way for collecting the data sent to a Jochen> socket or to learn about the stop of a connection that Jochen> might help? Jochen> This is how I am doing it now (taken from one of the demos Jochen> and/or the library reference from Guido. Jochen> Is this general the way python does this or is it Mac Jochen> specific? Jochen> print 'Response:' while 1: data = sock.recv(1024) print Jochen> data if not data: break sock.close() Jochen> Jochen Jochen> _______________________________________________ Tutor Jochen> maillist - Tutor@python.org Jochen> http://www.python.org/mailman/listinfo/tutor From YankoC@gspinc.com Fri Feb 4 11:55:11 2000 From: YankoC@gspinc.com (Yanko, Curtis (GSP)) Date: Fri, 4 Feb 2000 06:55:11 -0500 Subject: [Tutor] Making Window stay open, Python in Windows Message-ID: <23EF0668B5D3D111A0CF00805F9FDC440205DDCE@SRV_EXCH1> On Win9x you need to find the .PIF file for the shell and turn off it's 'close on exit' property. I think it is 'default' and in the Windows or windows/system dir. If this gives you fits you can make a shortcut to python.exe and set it there (the close on exit flag) and change your association to point to the shortcut. On NT the shortcut is the way to go since you can't get control of cmd.exe easily. However, there are some other great tricks available. If you run the interpreter and click on the python icon in the upper left you can set the properties for the window. I like to make mine 40 rows long instead of the default 25 and I up the buffer size to 200 or more so I can scroll back. There are a lot of other settings in here to play with as well. When you save these it'll make a PIF file that it'll use in all future launches. -Curt Yanko > -----Original Message----- > From: future@dotstar.net [SMTP:future@dotstar.net] > Sent: Thursday, February 03, 2000 2:11 PM > To: tutor@python.org > Subject: [Tutor] Making Window stay open, Python in Windows > > I am trying to learn Python on a Windows 95 system. I'm having the > problem > that after a type a program and run it the window closes before I can view > the output. How can I correct this? > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://www.python.org/mailman/listinfo/tutor From argoldman@mindspring.com Fri Feb 4 20:01:45 2000 From: argoldman@mindspring.com (A. R. Goldman) Date: Fri, 04 Feb 2000 15:01:45 -0500 Subject: [Tutor] my first (but probably not my last) questions... Message-ID: <389B3029.1A0A54A3@mindspring.com> --------------60288922147C00945AC3BC63 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Greetings: I am relatively new to Python (5 Days) and to programming in general (5 Days)... so I hope the you will forgive what are probably very elementary problems: 1st: I cannot seem to save programs in pythonwin... I hit "save as", pick my folder, and enter a name, followed by either .py, .pyw, or .txt extensions (I've tried all three)... but the programs never seem to arrive in the folder. The drop down menu only gives me the "all files *.*" option... I don't know if this is relevant. 2nd: I can save programs using idle... but can't seem to shut it down. I shut down the shell window, and the DOS window freezes... it won't respond to Ctrl-z. Ctrl-d, and (alas) not always to ctrl-alt-del. Finally: When I double click on any of the programs with the .py extension, the DOS Window opens for a second or two and then closes... I don't know if these problems are related... or if the are related to problems with installing the programs... Many thanks in advance for you help... and for the great language which makes the early steps in programming so much easier... A.R. Goldman --------------60288922147C00945AC3BC63 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit Greetings:
I am relatively new to Python (5 Days) and to programming in general (5 Days)... so I hope the you will forgive what are probably very elementary problems:
1st: I cannot seem to save programs in pythonwin... I hit "save as", pick my folder, and enter a name, followed by either .py, .pyw, or .txt extensions (I've tried all three)... but the programs never seem to arrive in the folder. The drop down menu only gives me the "all files *.*" option... I don't know if this is relevant.
2nd: I can save programs using idle... but can't seem to shut it down. I shut down the shell window, and the DOS window freezes... it won't respond to Ctrl-z. Ctrl-d, and (alas) not always to ctrl-alt-del.
Finally: When I double click on any of the programs with the .py extension, the DOS Window opens for a second or two and then closes...
I don't know if these problems are related... or if the are related to problems with installing the programs...
Many thanks in advance for you help... and for the great language which makes the early steps in programming so much easier...
A.R. Goldman --------------60288922147C00945AC3BC63-- From Alexandre Passos" I tried to make a program using PhotoImage Class on a Label widget. All I get is a blank window #! /usr/bin/env python from Tkinter import * root = Tk() class Foo: def __init__(self): self.a='foo.gif' self.b = Label(root, text=2) self.b.pack() PhotoImage(self.b, format='gif', file=self.a, width=100, height=100) app = Foo() root.mainloop() From deirdre@deirdre.net Sat Feb 5 23:44:22 2000 From: deirdre@deirdre.net (Deirdre Saoirse) Date: Sat, 5 Feb 2000 15:44:22 -0800 (PST) Subject: [Tutor] Persistent store for a single integer In-Reply-To: <00020318092404.01083@quadra.teleo.net> Message-ID: On Thu, 3 Feb 2000, Patrick Phalen wrote: > The Unique ID is an integer starting at 1000000 and incrementing by 1 > for each new "customer." > > So, in other words, when I write the data to the file, I need to > determine the last-used integer, increment it and concatenate this > UniqueID to most of the fields. > > What is a good persistence model for this integer? A file with a > mutex/lock? A pickled numeral? These seem kind of expensive. Actually, I typically use Gadfly (www.chordate.com) for this kind of thing, especially with my sequence number additions. > Naturally, I want to avoid data corruption in the case where many people > might access the form at once, take arbitrary time to complete the > form, etc., without blocking people for lengthy periods. -- _Deirdre * http://www.linuxcabal.net * http://www.deirdre.net "Mars has been a tough target" -- Peter G. Neumann, Risks Digest Moderator "That's because the Martians keep shooting things down." -- Harlan Rosenthal , retorting in Risks Digest 20.60 From jjohnson@astound.net Sun Feb 6 21:33:59 2000 From: jjohnson@astound.net (jiggity) Date: Sun, 6 Feb 2000 13:33:59 -0800 Subject: [Tutor] First Program! Message-ID: <002501bf70e9$e1845420$6e29db18@min.mn.bbnow.net> This is a multi-part message in MIME format. ------=_NextPart_000_0022_01BF70A6.D3271860 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I just learned Python and am wondering what type of program would be the = easiest to try to write. I am not looking for anything to fancy. Just = something to test what I can do. ------=_NextPart_000_0022_01BF70A6.D3271860 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
I just learned Python and am wondering = what type of=20 program would be the easiest to try to write.  I am not looking for = anything to fancy.  Just something to test what I can=20 do.
------=_NextPart_000_0022_01BF70A6.D3271860-- From gerrit@nl.linux.org Sun Feb 6 20:56:17 2000 From: gerrit@nl.linux.org (Gerrit Holl) Date: Sun, 6 Feb 2000 21:56:17 +0100 Subject: [Tutor] First Program! In-Reply-To: <002501bf70e9$e1845420$6e29db18@min.mn.bbnow.net>; from jjohnson@astound.net on Sun, Feb 06, 2000 at 01:33:59PM -0800 References: <002501bf70e9$e1845420$6e29db18@min.mn.bbnow.net> Message-ID: <20000206215617.A12414@stopcontact.palga.uucp> jiggity wrote on 949840439: > I just learned Python and am wondering what type of program would be the easiest to try to write. I am not looking for anything to fancy. Just something to test what I can do. Write a program that takes a random number and asks the user to input a number. If the user guesses to low, say so. If the user guesses to high, say so. Count the number of turns the user needs to guess the number, and tell him when he guessed the number. The exercises in "Learning Python" are also an excellent exercise. regards, Gerrit. -- -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth From wesc@alpha.ece.ucsb.edu Sun Feb 6 22:24:13 2000 From: wesc@alpha.ece.ucsb.edu (Wesley J. Chun) Date: Sun, 6 Feb 2000 14:24:13 -0800 (PST) Subject: [Tutor] First Program! Message-ID: <200002062224.OAA08450@alpha.ece.ucsb.edu> > Date: Sun, 6 Feb 2000 21:56:17 +0100 > From: Gerrit Holl > > jiggity wrote on 949840439: > > I just learned Python and am wondering what type of program would be the easiest to try to write. I am not looking for anything to fancy. Just something to test what I can do. > > Write a program that takes a random number and asks the user to input > a number. If the user guesses to low, say so. If the user guesses to > high, say so. Count the number of turns the user needs to guess the > number, and tell him when he guessed the number. gerrit's example sounds like a worthy project. here are some that like to give to my students: 1. a. write a program to take a year (either as user input via raw_input) or hard-coded (not as fun) and output whether it is a leap year. b. then split up your program to put the leap year logic inside a function and have the main part of your program call just the function for a quick yes/no (1/0) result, then push the output to the screen. recall that a leap is divisible by 4, but not 100, unless *that* is also divisible by 400. in other words, although 1800 and 1900 are divisible by 4, they are not divisible by 400, hence are not leap years. 2000 is a leap year; the next century leap yea won't come up again until 2400!! 2. a. write code that will take a string and invert it. in other words, create another string that is the same as the original string only going backwards! b. now either upgrade your program or come up with another way to: take two strings and de- termine if they are palindromic (same backwards as forwards), i.e. bob, eve, kayak, etc. c. upgrade your program again to ignore spaces, case, and punctuation, so that it recognizes sentences like: "Madam, I'm Adam." or "A man, a plan, a canal... Panama!" have fun!! -wesley wesc@alpha.ece.ucsb.edu http://www.roadkill.com/~wesc/cyberweb/ From Alexandre Passos" How can I make a random number? From wesc@alpha.ece.ucsb.edu Mon Feb 7 18:42:43 2000 From: wesc@alpha.ece.ucsb.edu (Wesley J. Chun) Date: Mon, 7 Feb 2000 10:42:43 -0800 (PST) Subject: [Tutor] Random Message-ID: <200002071842.KAA14125@alpha.ece.ucsb.edu> > From: "Alexandre Passos" > Date: Mon, 7 Feb 2000 16:17:16 -0200 > > How can I make a random number? take a look at the 'whrandom' module. in particular, there are mainly 5 functions of interest: whrandom() random number generator (RNG) constructor randint(a,b) retuns a random int i such that a <= i <= b uniform(a,b) retuns a random float f such that a <= i < b random(a,b) retuns a random float f such that 0.0 <= f < 1.0 choice() choose a random sequence element example: >>> import whrandom >>> rng = whrandom.whrandom() >>> rng.randint(3, 40) 36 >>> rng.randint(3, 40) 23 >>> rng.randint(3, 40) 12 >>> rng.randint(3, 40) 18 >>> rng.randint(3, 40) 27 hope this helps!! -wesley From joanca@typerware.com Mon Feb 7 19:54:31 2000 From: joanca@typerware.com (JoanCarles p Casas=?ISO-8859-1?Q?=edn?=) Date: Mon, 7 Feb 2000 20:54:31 +0100 Subject: [Tutor] Random Message-ID: <200002072010.PAA02554@python.org> Alexandre Passos wrote: >How can I make a random number? import random listofn = range(1,1000) #a list containing integers from 1 to 999 a = random.choice(listofn) #choice a random element from a list print a I don't know if there's a better way for doing it but this works for me... Hope this helps, JoanCarles :::!!!::: joanca@typerware.com http://www.typerware.com From shulag@netvision.net.il Mon Feb 7 23:38:37 2000 From: shulag@netvision.net.il (shulag@netvision.net.il) Date: Tue, 8 Feb 2000 01:38:37 +0200 (IST) Subject: [Tutor] Use YOUR Software to update YOUR users Message-ID: Dear Sir/Madam We are sure that you already have a large number of customers and it will increase greatly in the near future. How would you like to know them better and be able to address them directly? We enable customer relationship management for the software industry. Softalker is an add-on to desktop software applications. It facilitates direct communication between Independent Software Vendor and all his customers: send information regarding new products and services, courses and conventions, new website content, usage tips, etc. You can send high-impact multi-media messages through your application, so that customers receive important information in the most natural, unobtrusive and economic way. At the same time, you can gather valuable insights for product development and marketing. Since you come to CeBIT, why don't we set up a short meeting, so we can show you that Softalker is the easiest way to achieve more sales and better customer understanding. Sincerely Yours Efi Paz cebit@internum.com +972-9-9514502 ##################### Visit Internum at CeBIT 2000 Hanover 24.2-1.3/2000 See Softalker in action, in our booth, Hall 4, Stand A11 Our phone at the exhibition: +49-511-89-53320 (6-2-00) From adriane_longshor@hotmail.com Tue Feb 8 21:12:09 2000 From: adriane_longshor@hotmail.com (age long) Date: Tue, 08 Feb 2000 21:12:09 GMT Subject: [Tutor] (no subject) Message-ID: <20000208211209.79623.qmail@hotmail.com> take me off your list please ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com From craig@osa.att.ne.jp Wed Feb 9 11:30:36 2000 From: craig@osa.att.ne.jp (Craig Hagerman) Date: Wed, 9 Feb 2000 20:30:36 +0900 Subject: [Tutor] writing changes to a file Message-ID: Hi Hope this isn't too elementary: I need some guidance in how to open and existing file, write some changes to it and then then close it. So far I have been creating a new file for the changed version like this: input = open('file_one','r') output = open('file_two','w') However, I don't always need to have two files. I only want to change all instances of "x" to "y", or perhaps add some new lines to the existing file, and then save the new version. Is it possible to open a file to write some changes to it in one go? Thanks, Craig Hagerman From wesc@alpha.ece.ucsb.edu Wed Feb 9 11:52:17 2000 From: wesc@alpha.ece.ucsb.edu (Wesley J. Chun) Date: Wed, 9 Feb 2000 03:52:17 -0800 (PST) Subject: [Tutor] writing changes to a file Message-ID: <200002091152.DAA01308@alpha.ece.ucsb.edu> > Date: Wed, 9 Feb 2000 20:30:36 +0900 > From: Craig Hagerman > > Hope this isn't too elementary: I need some guidance in how to open and > existing file, write some changes to it and then then close it. So far I > have been creating a new file for the changed version like this: > > input = open('file_one','r') > output = open('file_two','w') > > However, I don't always need to have two files. I only want to change all > instances of "x" to "y", or perhaps add some new lines to the existing > file, and then save the new version. Is it possible to open a file to write > some changes to it in one go? craig, your quandry can be repeated across other languages as well, not just Python. depending on your situation, you can approach them differently: 1) changing all instances of 'x' to 'y' (and similar) if you have a text file (as opposed to a binary), this sounds like a situation that calls for a simple filter than scans for a particular string and replaces it with another. you can ac- complish this in Python, Perl, awk, or a unix shell script that calls the 'sed' utilities. if you want to do this in Python, check out the 're' modules, which you can use to describe a pattern to look for, as well as one to substitute with. 2) add some new lines to an existing file if you want to just append to an existing file, use the append mode: f = open(your_file, 'a') if you want to both read *and* write to your existing file, use update mode: f = open(your_file, 'r+') the '+' means open the file for reading and writing, i.e. update. ('w+' means delete the existing file and open a new one for read and write so be careful!) anyway, once you open the file, you can use f.seek() and f.tell() to navigate within the file. if you are going to read and write to your file, make sure you explicitly f.flush() between change of operations. hope this helps! -wesley cyberbweb.consulting :: silicon.valley, ca http://www.roadkill.com/~wesc/cyberweb/ From Gerrit Wed Feb 9 16:08:08 2000 From: Gerrit (Gerrit Holl) Date: Wed, 9 Feb 2000 17:08:08 +0100 Subject: [Tutor] Random In-Reply-To: <200002072010.PAA02554@python.org>; from joanca@typerware.com on Mon, Feb 07, 2000 at 08:54:31PM +0100 References: <200002072010.PAA02554@python.org> Message-ID: <20000209170808.A1276@stopcontact.palga.uucp> JoanCarles p Casasín wrote on 949953271: > Alexandre Passos wrote: > > >How can I make a random number? > > import random > > listofn = range(1,1000) #a list containing integers from 1 to 999 > a = random.choice(listofn) #choice a random element from a list > print a > > > I don't know if there's a better way for doing it but this works for me... It works, but the following has much better performance: >>> import random >>> random.randint(0, 1000) 67 It doesn't need to create a list. Consider: >>> random.random() * 1000 786.880856997 >>> round(random.random() * 1000) 30.0 >>> int(round(random.random() * 1000)) 74 regards, Gerrit. -- Homepage: http://www.nl.linux.org/~gerrit -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK----- moc.edockeeg.www//:ptth From joanca@typerware.com Wed Feb 9 18:01:12 2000 From: joanca@typerware.com (JoanCarles p Casas=?ISO-8859-1?Q?=edn?=) Date: Wed, 9 Feb 2000 19:01:12 +0100 Subject: [Tutor] Random Message-ID: <200002091752.MAA12807@python.org> Gerrit Holl wrote: >> import random >> >> listofn = range(1,1000) #a list containing integers from 1 to 999 >> a = random.choice(listofn) #choice a random element from a list >> print a >> >> >> I don't know if there's a better way for doing it but this works for me... > >It works, but the following has much better performance: >>>> import random >>>> random.randint(0, 1000) >67 >It doesn't need to create a list. Consider: >>>> random.random() * 1000 >786.880856997 >>>> round(random.random() * 1000) >30.0 >>>> int(round(random.random() * 1000)) >74 Thanks for the note. My problem is that I think: 1) make things work 2) make things work in a clever way But I use to stop once I get the first step and go for another thing. Thanks! JoanCarles :::!!!::: joanca@typerware.com http://www.typerware.com From wesc@alpha.ece.ucsb.edu Wed Feb 9 20:36:57 2000 From: wesc@alpha.ece.ucsb.edu (Wesley J. Chun) Date: Wed, 9 Feb 2000 12:36:57 -0800 (PST) Subject: [Tutor] Dictionaries... Message-ID: <200002092036.MAA05436@alpha.ece.ucsb.edu> > From: rhicks@rma.edu > Date: Wed, 9 Feb 100 13:10:17 +0000 > > On page 50 of "Learning Python" is makes the statement > that dictionaries in Python are randomized in their order > in order to provide quick lookup. I have talked to a > programmer buddy and he doesn't know why this is. Why does > an unordered list provide a quick lookup? good question. in order to answer you, your programmer buddy would've had to take a data structures course! ;-) regarding your inquiry, dictionaries in Python (like associa- tive arrays or 'hashes' in Perl) are implemented as HASH TABLES, which you can think of as large and sparsely-populated "arrays." Hash tables use two data items for storage, keys and values. For every key, there is a value associated with it, commonly referred to as "key-value pairs." hash tables are data structures that organize the order of the data based on performing a calculation on your keys to find the proper spot in the array for your values. that calculation is called a hash function, and depending on your key, it could 'map' your value anywhere, but will always map it to the same place (hence why dictionaries are called a 'mapping' type). as a result, all your values are as scattered as your keys are dif- ferent, hence the disordering of all your data. there are no longer sequential indexes into your 'array' now. your next obvious question then, is why?!? well, to put it simply, if you need to find something in a list, you would have to traverse the data items, and if the size of your sequence is very large, it will affect the performance (takes longer to go thru everything). but with a hash table, because you have a key, you can get to its value immediately. in other words, the speed of hash lookups (which is already fast) will not slow down as the size of the data gets larger and larger. hope this helps!! i'm sure others will chime in here as well. hashing-ly y'rs, -wesley ps1 if you want ordering, you can suck the keys into a list and use the list's sort() method, then get the values in your sorted key order. ps2 sometimes more than one key map to the same place... that is called a hash collision, so some spots would have to hold multiple values, but they are few and far in between. this is implemented at the lower-layers so you will not see this in Python dictionaries or Perl hashes. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - wesley j. chun cyberweb.consulting :: silicon.valley, ca http://www.roadkill.com/~wesc/cyberweb/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From sjblaw@cloudnet.com Thu Feb 10 03:34:30 2000 From: sjblaw@cloudnet.com (Tom Janson) Date: Wed, 9 Feb 2000 21:34:30 -0600 Subject: [Tutor] start programming Message-ID: <006201bf7377$bdf7cf60$4bf1ddcc@tomlaptop> This is a multi-part message in MIME format. ------=_NextPart_000_005F_01BF7345.72C64F80 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I want to start programming. I have download pyhon but need instuctions = on creating, saving, and running the programs I make. Thank You. -Future Programmer ------=_NextPart_000_005F_01BF7345.72C64F80 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
I want to start programming.  I = have=20 download pyhon but need instuctions on creating, saving, and running the = programs I make. Thank You.
 
-Future = Programmer
------=_NextPart_000_005F_01BF7345.72C64F80-- From warren@nightwares.com Thu Feb 10 03:40:56 2000 From: warren@nightwares.com (Warren 'The Howdy Man' Ockrassa) Date: Wed, 09 Feb 2000 21:40:56 -0600 Subject: [Tutor] start programming References: <006201bf7377$bdf7cf60$4bf1ddcc@tomlaptop> Message-ID: <38A23348.EFFF1DE5@nightwares.com> > Tom Janson wrote: > I want to start programming. I have download pyhon but need > instuctions on creating, saving, and running the programs I make. Hey, welcome aboard! The best place to start your search is a liberal and lengthy surf of the official Python site, http://www.python.org/ . If you really probe in depth, you'll find resources there enough to satisfy your curiosity for weeks, at least. There are also suggestions there on what books to read, if you are a hardcopy-documentation kind of person. Enjoy! -- warren ockrassa | nightwares | mailto:warren@nightwares.com -- n i g h t w a r e s -- director faq lingo tutorial free files links http://www.nightwares.com/ From curtis.larsen@Covance.Com Thu Feb 10 14:58:15 2000 From: curtis.larsen@Covance.Com (Curtis Larsen) Date: Thu, 10 Feb 2000 08:58:15 -0600 Subject: [Tutor] Lost, and Asking for Dir()-ections Message-ID: Probably a silly question, but I'm new to this object-oriented stuff. When doing a dir(object) to see what functions/methods are available in a script, how do I know if something is a function or a method? I ask because after I use dir() on a script, I try doing a "scriptname.functionname() to call up the likely thing I want to do -- "urllib.test()" for example. I tried doing this with a recent script I picked up, and after doing the same thing ("scriptname.blah()"), it returned "". It wouldn't actually do what I was looking for until I gave it an equation such as "x=scriptname.blah()". Then an "x" object was created with property values, etc., that contained what I was looking for. How would I recognize the need for using this equation notation in the future? (What's the diff?) Yes, I know I can just read the script to further understand it -- and I do that a lot -- but (as part of the whole "learning Python" process) I'm interested in writing a script that does that on it's own for me. I can write a script that does vars() and dir() against scripts, checks out any __doc__ stuff it finds, and then prints the results, but how would I tell it to perceive the difference between "scriptname.something(args)" working and having to do an "x=scriptname.something(args)" to get the "something" to work? (Can you tell I'm confused about this?) Any suggestions, advice, pointing-in-the-right-direction, or go-read-the-specific-docs-at-this-site information is welcome. Thanks! Curtis begin 644 TEXT.htm M/"%$3T-465!%($A434P@4%5"3$E#("(M+R]7,T,O+T141"!(5$U,(#0N,"!4 M7!E/@T*/$U%5$$@8V]N=&5N=#TB35-(5$U,(#4N,#`N,C2!Q=65S=&EO;BP@8G5T($DG;2!N97<@=&\@=&AI2!T:&EN9R9N8G-P M.TD@=V%N="!T;R!D;R`M+2`B=7)L;&EB+G1E#US8W)I<'1N86UE+F)L86@H*2(N)FYBF4@=&AE(&YE960@9F]R('5S:6YG('1H:7,@97%U871I;VX@ M;F]T871I;VX@:6X@=&AE(`T*9G5T=7)E/SPO1$E6/@T*/$1)5CXH5VAA="=S M('1H92!D:69F/RD\+T1)5CX-"CQ$258^)FYB2!S M=6=G97-T:6]N Message-ID: On Wed, 9 Feb 2000, Tom Janson wrote: > I want to start programming. I have download pyhon but need > instuctions on creating, saving, and running the programs I make. Thank > You. On Linux/Unix? Windows? Mac? -- _Deirdre * http://www.linuxcabal.net * http://www.deirdre.net "Mars has been a tough target" -- Peter G. Neumann, Risks Digest Moderator "That's because the Martians keep shooting things down." -- Harlan Rosenthal , retorting in Risks Digest 20.60 From dyoo@hkn.EECS.Berkeley.EDU Thu Feb 10 22:08:36 2000 From: dyoo@hkn.EECS.Berkeley.EDU (Daniel Yoo) Date: Thu, 10 Feb 2000 14:08:36 -0800 (PST) Subject: [Tutor] Dictionaries In-Reply-To: <20000210170011.2CBE21CDA6@dinsdale.python.org> Message-ID: > Message: 3 > From: rhicks@rma.edu > To: tutor@python.org > Date: Wed, 9 Feb 100 13:10:17 +0000 > Subject: [Tutor] Dictionaries... > > On page 50 of "Learning Python" is makes the statement that dictionaries in > Python are randomized in their order in order to provide quick lookup. I have > talked to a programmer buddy and he doesn't know why this is. Why does an > unordered list provide a quick lookup? When they say unordered, they don't mean that the list has no pattern. What they refer to is the function that, given a key, figures out where a value is in the list. What we need is a nice function that evenly distributes the keys through the list, and it's this that makes the list look "unordered". Getting a list of keys off this table will give us an "unordered" list. The randomized part refers to the way the categories are chosen. It's not quite alphabetic; it does some extra stuff to make sure that the buckets have the same distribution of elements. So that's why the list's unordered. From dyoo@hkn.EECS.Berkeley.EDU Fri Feb 11 07:32:32 2000 From: dyoo@hkn.EECS.Berkeley.EDU (Daniel Yoo) Date: Thu, 10 Feb 2000 23:32:32 -0800 (PST) Subject: [Tutor] writing changes to a file In-Reply-To: <20000209170008.46B421CD88@dinsdale.python.org> Message-ID: > Hope this isn't too elementary: I need some guidance in how to open and > existing file, write some changes to it and then then close it. So far I > have been creating a new file for the changed version like this: > > input = open('file_one','r') > output = open('file_two','w') > > However, I don't always need to have two files. I only want to change all > instances of "x" to "y", or perhaps add some new lines to the existing > file, and then save the new version. Is it possible to open a file to write > some changes to it in one go? You can try to slurp up all the lines of the file, close the file, and open it again as writable: input = open('file_one', 'r') lines = input.readlines() input.close() output = open('file_one', 'w') ... You can manipulate lines, and then write lines back to output. From andre@beta.telenordia.se Fri Feb 11 18:03:40 2000 From: andre@beta.telenordia.se (=?ISO-8859-1?Q?Andr=E9_Dahlqvist?=) Date: Fri, 11 Feb 2000 19:03:40 +0100 (CET) Subject: [Tutor] Using sockets or telnetlib to finger? Message-ID: Hello Python gurus I am working on my first Python program, which will be used to finger a host that reports the latest stable, development and pre-patch version of the Linux kernel. I have come up with two different solutions on how to finger the host, and since I'm new to Python I am not sure which of these approaches is preferred. My first attempt was to use sockets: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect(HOST, PORT) sock.send('\n') while 1: kernel_info = sock.recv(1024) if not kernel_info: break This solution seams to do the trick, but so does my next approach which uses telnetlib to telnet in to the finger port: telnet = telnetlib.Telnet(HOST, PORT) telnet.write('\n') kernel_info = telnet.read_all() telnet.close() I myself prefer the telnetlib solution as it seams less "low-level", but since I'm brand new to Python I would like to hear what you gurus have to say about it. Whatever approach I use I then need to grab the three version numbers from the finger output that I have collected. The finger output will look like this, where only the version numbers change: [zeus.kernel.org] The latest stable version of the Linux kernel is: 2.2.14 The latest beta version of the Linux kernel is: 2.3.43 The latest prepatch (alpha) version *appears* to be: 2.3.44-4 I need to access the version numbers alone, since I want to translate the rest of the text. To do this I have used what I think is an ugly method. What I do is that I split the string that contains this information with string.split(), and then access the version numbers directly in the resulting list using kernel_info[9], kernel_info[19] and kernel_info[28]. It seams quiet safe to do it like this since the text, apart from the version numbers, pretty much never changes, but is there perhaps a equally simple solution that is less ugly? Could regular expressions do the trick here, and if so can someone perhaps give an example of how I would use them in this situation? I have one last question, is this a correct way to have a string span several lines: a_string = "can I do this to have a string \ continue on a second line?" Regards André =================================================================== André Dahlqvist GnuPG Key ID: 0x70A2994A Fingerprint: E947 3297 331C CA30 5B88 EDF2 A830 3EBE 70A2 994A =================================================================== From bill.anderson@libc.org Sat Feb 12 01:19:54 2000 From: bill.anderson@libc.org (Bill Anderson) Date: Fri, 11 Feb 2000 18:19:54 -0700 Subject: [Tutor] Weighted Random numbers Message-ID: <38A4B53A.C3A52B35@libc.org> I am working on a bannerad system in Python (for Zope). I have most of it functional, but I need to be able to weight certain selections, just as with any of the myriad perl implementations. Anyone have any pointers on a way to do this in python? TIA, Bill -- In flying I have learned that carelessness and overconfidence are usually far more dangerous than deliberately accepted risks. -- Wilbur Wright in a letter to his father, September 1900 From wesc@alpha.ece.ucsb.edu Sat Feb 12 11:16:03 2000 From: wesc@alpha.ece.ucsb.edu (Wesley J. Chun) Date: Sat, 12 Feb 2000 03:16:03 -0800 (PST) Subject: [Tutor] Weighted Random numbers Message-ID: <200002121116.DAA20152@alpha.ece.ucsb.edu> > Date: Fri, 11 Feb 2000 18:19:54 -0700 > From: Bill Anderson > > I am working on a bannerad system in Python (for Zope). I have most of > it functional, but I need to be able to weight certain selections, just > as with any of the myriad perl implementations. Anyone have any pointers > on a way to do this in python? the best way to do this is to choose from a weighted list of 1 to 100 say, with each number representing a percentage or proportion of the time an ad should be chosen. each ad would get a "range" based on the %age of the time it should show. the "odds" of all the individual ads summed together should be 100. for example, a heavily weight ad (from BigBucksAdAgency) may get 50% and be given the segment from 1-50. another ad, not as prominent may get 25%, so it gets 51-75. a 3rd and 4th ad get 10% each, so 76-85, and 86-95, re- spectively, and the 5th and final ad gets 5%, 96-100. when displaying a page, choose a random number from 1-100. whose ad shows up depends on whose range was hit with the chosen number. now this is just a highly simplistic model that could work with Python as well as other languages; i'm sure you can grow it to fit your needs or come up with a Python-only solution. i haven't dug around the NumPy module yet so i'm not sure if there is not already something like this in there. anyone? hope this helps!! -wesley cyberweb.consulting :: silicon.valley, ca http://www.roadkill.com/~wesc/cyberweb/ From wesc@alpha.ece.ucsb.edu Sat Feb 12 11:31:03 2000 From: wesc@alpha.ece.ucsb.edu (Wesley J. Chun) Date: Sat, 12 Feb 2000 03:31:03 -0800 (PST) Subject: [Tutor] Lost, and Asking for Dir()-ections Message-ID: <200002121131.DAA20197@alpha.ece.ucsb.edu> > Date: Thu, 10 Feb 2000 08:58:15 -0600 > From: "Curtis Larsen" > > Probably a silly question, but I'm new to this object-oriented stuff. aren't we all?!? ;-) > > When doing a dir(object) to see what functions/methods are available in > a script, how do I know if something is a function or a method? I ask > because after I use dir() on a script, I try doing a > "scriptname.functionname() to call up the likely thing I want to do -- > "urllib.test()" for example. right. when you import a module and do a dir(module), you get a list of valid attributes for that module, whether it be a variable or function. you had another question up there, regarding the difference between a function and a method. to put it simply, a method is just a function defined for a class. other than that, functions and methods are pretty much the same, so i'm not sure what you're asking there. i think what you want to say is, "how can i tell if a module's attribute is just a variable or a function that i can call?" vars() is like an extended version of dir(). it shows not only what the attributes are, but what their values are; and from that, it is pretty easy to deduct what types they are. > > I tried doing this with a recent script I picked up, and after doing the > same thing ("scriptname.blah()"), it returned " instance at memorylocation>". It wouldn't actually do what I was > looking for until I gave it an equation such as "x=scriptname.blah()". > Then an "x" object was created with property values, etc., that > contained what I was looking for. what you did there is you accessed a class. now this may be confusing, but taking a class and making an instance out of it works the *same way* as calling a function... but you are not really doing that... it just *looks* like it. if foo is a function, you would use foo() to call it right? but if MyClass was a class, you would use MyClass() to create an instance (object) of that class! looks *are* deceiving!! when you did module.MyClass() standalone above, you created an instance of a class, but did not assign it to any variable, so the interpreter just spit the instance back at you, hence the . when you did x=module.MyClass(), it correctly created the instance for you, but because you assigned it to a variable, the interpreter did not spit out that message. i can guar- antee you that if you did typed 'x' by itself right after you did the x=module.MyClass(), it would give you the exact same message: . > > How would I recognize the need for using this equation notation in the > future? (What's the diff?) from the above, we can see that you did two different things: 1) called a function in a module, i.e. urllib.test() 2) created a class instance (which also uses the "functional notation")... it appears you were calling a function when you weren't. that's the difference. the first example had nothing to do with classes, so this "equation notation" was not necessary because you were not creating an object. (now it *is* pos- sible that the function you execute returns an object to you in which case it's a good idea to save it via the "equation notation" you mentioned.) in the second example you *are* creating an object, and that is why you would need to save it... if you didn't, you would not have any way to access that object or the goodies inside. hope this helps!! -wesley cyberweb.consulting :: silicon.valley, ca http://www.roadkill.com/~wesc/cyberweb/ From bill.anderson@libc.org Sat Feb 12 22:40:43 2000 From: bill.anderson@libc.org (Bill Anderson) Date: Sat, 12 Feb 2000 15:40:43 -0700 Subject: [Tutor] Weighted Random numbers References: <200002121116.DAA20152@alpha.ece.ucsb.edu> Message-ID: <38A5E16B.71DCA169@libc.org> (x-posted to comp.lang.python in the hopes of reaching a wider audience [esp re: NumPY]... hope nobody minds) "Wesley J. Chun" wrote: > > > Date: Fri, 11 Feb 2000 18:19:54 -0700 > > From: Bill Anderson > > > > I am working on a bannerad system in Python (for Zope). I have most of > > it functional, but I need to be able to weight certain selections, just > > as with any of the myriad perl implementations. Anyone have any pointers > > on a way to do this in python? > > the best way to do this is to choose from a weighted > list of 1 to 100 say, with each number representing a > percentage or proportion of the time an ad should be > chosen. each ad would get a "range" based on the %age > of the time it should show. the "odds" of all the > individual ads summed together should be 100. > > for example, a heavily weight ad (from BigBucksAdAgency) > may get 50% and be given the segment from 1-50. another > ad, not as prominent may get 25%, so it gets 51-75. a > 3rd and 4th ad get 10% each, so 76-85, and 86-95, re- > spectively, and the 5th and final ad gets 5%, 96-100. That's a lot like what I was thinking. I as considering building a list of banners, with the weight being the number of times the ad was in the list. Then using whrandom, I'd select one. The only issue I see so far with the percentage method, is that it makes management more of a headache. In order to set weights, I would need a master page with all the banners, their weight percentage, and the total. Hmmm ... some random unweighted-thoughts ... I think the difference in these two methods are in the type of weighting. In my method, the weight is against a non-weighted ad, that is, an ad with weight 1. An ad with weight 5 is 5x more likely to be seen than a standard ad. In your method, the weight is relative to the other ads. An ad with weight 5 will be seen 5% of the time. The difference is sublt, but important, IMHO. I guess unless I (or anyone else ;) can come up with a different method, I'll probably wind up implementing them both, with an option to select at system creation time. Bill -- In flying I have learned that carelessness and overconfidence are usually far more dangerous than deliberately accepted risks. -- Wilbur Wright in a letter to his father, September 1900 From wesc@alpha.ece.ucsb.edu Sat Feb 12 23:44:00 2000 From: wesc@alpha.ece.ucsb.edu (Wesley J. Chun) Date: Sat, 12 Feb 2000 15:44:00 -0800 (PST) Subject: [Tutor] Weighted Random numbers Message-ID: <200002122344.PAA01989@alpha.ece.ucsb.edu> > Date: Sat, 12 Feb 2000 15:40:43 -0700 > From: Bill Anderson > > (x-posted to comp.lang.python in the hopes of reaching a wider audience > [esp re: NumPY]... hope nobody minds) nah... they're Python-people! ;-) > > "Wesley J. Chun" wrote: > > > > > Date: Fri, 11 Feb 2000 18:19:54 -0700 > > > From: Bill Anderson > > > > > > I am working on a bannerad system in Python... I have most of > > > it functional, but I need to be able to weight certain selections > > > > the best way to do this is to choose from a weighted > > list of 1 to 100 say, with each number representing a > > percentage or proportion of the time an ad should be > > chosen. each ad would get a "range" based on the %age > > of the time it should show. the "odds" of all the > > individual ads summed together should be 100. > > > > for example, a heavily weight ad (from BigBucksAdAgency) > > may get 50% and be given the segment from 1-50. another > > ad, not as prominent may get 25%, so it gets 51-75. a > > 3rd and 4th ad get 10% each, so 76-85, and 86-95, re- > > spectively, and the 5th and final ad gets 5%, 96-100. > > That's a lot like what I was thinking. I as considering building a list > of banners, with the weight being the number of times the ad was in the > list. Then using whrandom, I'd select one. > > The only issue I see so far with the percentage method, is that it makes > management more of a headache. In order to set weights, I would need a > master page with all the banners, their weight percentage, and the > total. i think a separate thingy called an adserver would work best. the adserver keeps inventory and manages all the ads, the pages they should'can appear on, their weights, etc. don't let your webserver handle this logic... it should just make a single call to the adserver to get the ad and that's it; the processing power should all go to Apache and your users. > > Hmmm ... some random unweighted-thoughts ... > I think the difference in these two methods are in the type of > weighting. > In my method, the weight is against a non-weighted ad, that is, an ad > with weight 1. An ad with weight 5 is 5x more likely to be seen than a > standard ad. In your method, the weight is relative to the other ads. An > ad with weight 5 will be seen 5% of the time. The difference is sublt, > but important, IMHO. i agree. again, this is just the first idea that popped out. i'm sure some college professors and their minions are already working on adservering algorithms by now!! (this is, of course in addition to all the methods that have been used by traditional media for the last XXX years.) we-shall-serve-them-proud-ly y'rs, -wesley cyberweb.consulting :: silicon.valley, ca http://www.roadkill.com/~wesc/cyberweb/ From dworkin@ccs.neu.edu Mon Feb 14 02:48:51 2000 From: dworkin@ccs.neu.edu (Justin Sheehy) Date: 13 Feb 2000 21:48:51 -0500 Subject: [Tutor] Using sockets or telnetlib to finger? In-Reply-To: André Dahlqvist's message of "Fri, 11 Feb 2000 19:03:40 +0100 (CET)" References: Message-ID: Andr=E9 Dahlqvist writes: > I myself prefer the telnetlib solution as it seams less "low-level", = but > since I'm brand new to Python I would like to hear what you gurus hav= e to > say about it. I would say that either is fine. If you prefer telnetlib, use it. > Whatever approach I use I then need to grab the three version numbers= from > the finger output that I have collected. The finger output will look = like > this, where only the version numbers change: >=20 > [zeus.kernel.org] >=20 > The latest stable version of the Linux kernel is: 2.2.14 > The latest beta version of the Linux kernel is: 2.3.43 > The latest prepatch (alpha) version *appears* to be: 2.3.44-4 >=20 > I need to access the version numbers alone, since I want to translate= the > rest of the text. To do this I have used what I think is an ugly=20=20 > method. What I do is that I split the string that contains this=20=20 > information with string.split(), and then access the version numbers= =20 > directly in the resulting list using kernel_info[9], kernel_info[19] = and > kernel_info[28]. There are a number of ways. If you are going to use string.split(), you could first split on newlines and then split again, using the [-1] index to get the last item from each line. > Could regular expressions do the trick here, and if so can someone > perhaps give an example of how I would use them in this situation? One quick re-based solution could be something like: re.findall('[\d\.\-]+', kernel_info) > a_string =3D "can I do this to have a string \ > continue on a second line?" That depends on exactly what you mean by that statement. That method will let you compose strings over multiple lines, but the resulting string will be a single line. People generally use either use triple-quotes or escape codes. That is: >>> b =3D """this string occupies=20=20=20 ... two lines""" >>> c =3D "so does\nthis one" I tend to use the latter more often, but it's a matter of style. -Justin =20 =20=20 From caughell@netrover.com Tue Feb 15 11:55:35 2000 From: caughell@netrover.com (Caughell family) Date: Tue, 15 Feb 2000 06:55:35 -0500 (EST) Subject: [Tutor] my first program Message-ID: <200002151155.GAA15273@river.netrover.com> This is a little program I designed to test experimental odds against theoretical odds. There is a problem. After much deliberation, I simplified the formula that I was using to make the differentiation percentage with, which ended up doing the exact same thing, just simpler. However, the program still wouldn't work. The problem is that I don't know how to make a division become a real number, especially when involving variables. (I know that I can do 2/7.0 instead of 2/7 to make it a real result) Thanks a lot! Also, I've got one question involving real numbers in this python.. is there any way that I can limit the number to a certain ammount of decimal places? will it be rounded or truncated, or automatically rounded up? Thanks very much!!! From alan.gauld@bt.com Tue Feb 15 11:56:00 2000 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Tue, 15 Feb 2000 11:56:00 -0000 Subject: [Tutor] Making Window stay open, Python in Windows Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB202DF6039@mbtlipnt02.btlabs.bt.co.uk> > that after a type a program and run it the window closes > before I can view the output. How can I correct this? Start a DOS box on its own then at the DOS prompt CD into your python project directory and invoke python by typing: C:\MyprojectDir> python spam.py Where: MyProjectDir is where you keep your python files and spam.py is your program file Alternatively: Make sure your PYTHONPATH environment variable is set up (in autoexec.bat) to include any directories with your modules in. Then you can type from any Dos prompt: C:\> python C:\MyProjectDir\spam.py Then python will finish executing and the results will be displayed in the DOS box. You might want to make the DOS box 50 lines long to ensure you capture as much as possible... Alan G. From alan.gauld@bt.com Tue Feb 15 12:44:55 2000 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Tue, 15 Feb 2000 12:44:55 -0000 Subject: [Tutor] writing changes to a file Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB202DF603D@mbtlipnt02.btlabs.bt.co.uk> > > file, and then save the new version. Is it possible to open > a file to write some changes to it in one go? Yes, under certain circumstances. In particular if X and Y are the exact same size in bytes you can replace in situ by opening the file with "r+" mode - read and write. You can then search the file by reading one char at a time and you can then use the seek()/tell() function to find your position in the file and write() to put the new data there. This is frought with danger and I don't recommend it unless there's a very good reason for not using an input/output file combination. (In fact I've only ever done it in C never in Python which has a slightly different write() mechanism... - it specifies how many bytwes to write) But it should be possible... Its much easier to replace the whole line (aka record) at a time but that's usually only practical if the records are fixed length. From Emile van Sebille" Message-ID: <06e701bf77c1$8ba05fc0$01ffffc0@worldnet.att.net> >>> a = 1 >>> b = 3.0 >>> print a/b 0.333333333333 >>> b = 3 >>> print a/float(b) 0.333333333333 >>> print a/b 0 >>> print round(a/float(b),2) 0.33 >>> HTH Emile van Sebille emile@fenx.com ------------------- ----- Original Message ----- From: Caughell family To: Sent: Tuesday, February 15, 2000 3:55 AM Subject: [Tutor] my first program > This is a little program I designed to test experimental odds against > theoretical odds. > > There is a problem. > > After much deliberation, I simplified the formula that I was using to make > the differentiation percentage with, which ended up doing the exact same > thing, just simpler. However, the program still wouldn't work. > > The problem is that I don't know how to make a division become a real > number, especially when involving variables. (I know that I can do 2/7.0 > instead of 2/7 to make it a real result) > > Thanks a lot! > > Also, I've got one question involving real numbers in this python.. > is there any way that I can limit the number to a certain ammount of decimal > places? will it be rounded or truncated, or automatically rounded up? > > Thanks very much!!! > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://www.python.org/mailman/listinfo/tutor > From curtis.larsen@Covance.Com Tue Feb 15 15:24:43 2000 From: curtis.larsen@Covance.Com (Curtis Larsen) Date: Tue, 15 Feb 2000 09:24:43 -0600 Subject: [Tutor] Lost, and Asking for Dir()-ections Message-ID: Thanks, that did help me out (explains a lot too)! Curtis >>> "Wesley J. Chun" 02/12/00 05:31AM >>> begin 644 TEXT.htm M/"%$3T-465!%($A434P@4%5"3$E#("(M+R]7,T,O+T141"!(5$U,(#0N,"!4 M7!E/@T*/$U%5$$@8V]N=&5N=#TB35-(5$U,(#4N,#`N,CDQ M.2XV,S`W(B!N86UE/4=%3D52051/4CX\+TA%040^#0H\0D]$62!B9T-O;&]R M/2-F9F9F9F8@#0IS='EL93TB1D].5#H@,3!P="!!#L@34%21TE.+51/4#H@,G!X(CX-"CQ$258^5&AA;FMS+"!T:&%T M(&1I9"!H96QP(&UE(&]U="`H97AP;&%I;G,@82!L;W0@=&]O*2$\+T1)5CX- M"CQ$258^)FYB2!D=7)N(&=O;V0@ There was a lady named Emile van Sebille that helped me out with my real number problem, and included a small program to illustrate the solution. Thank you very much Emile! However, I now have another question!! How would you go about getting rid of the last decimal place on a number when you're printing it? Possibly this will help me do things like Print '$',d (to two decimal places) and allow me to display $4.50 instead of $ 4.5 So far I've downloaded about 6 basic programs in python (that taught me input and raw_input !!), which I haven't fully gone through, and I've read to the beginning of chapter (section?) 5 in Guido's tutorial. I'm having a little trouble understanding lists but I will probably just go on until it clicks. From caughell@netrover.com Wed Feb 16 04:32:01 2000 From: caughell@netrover.com (Caughell family) Date: Tue, 15 Feb 2000 23:32:01 -0500 (EST) Subject: [Tutor] On top of my last message.. Message-ID: <200002160432.XAA20628@river.netrover.com> I would also like to thank Moshe Zadka, who sent a reply with a lot of information and a little recommended reading. He also answered what was going to be my next question! I remember clearly thinking, after hitting send, "I hope I don't ask a question that someone has already answered.." Next time I promise to read my entire In Box! Sorry. However, I still don't know how to make something print without adding spaces between variables. Nor do I know how to clear a screen (I just printed a bunch of lines in my first program!), nor do I know how to use the equivalent of the gotoxy command from Pascal, or I would have been able to just jump to the point of the dollar sign. Thanks a lot, guys! Take care, Dave. From Edanalea@cs.com Wed Feb 16 09:27:48 2000 From: Edanalea@cs.com (Edanalea@cs.com) Date: Wed, 16 Feb 2000 04:27:48 EST Subject: [Tutor] new Message-ID: <6b.1ae5ac9.25dbc794@cs.com> Dear, Python I new at all this and would like to know where to start THANK YOU TOM. From strat_addict@yahoo.com Wed Feb 16 11:13:03 2000 From: strat_addict@yahoo.com (G. Norton) Date: Wed, 16 Feb 2000 03:13:03 -0800 (PST) Subject: [Tutor] Coming back to Python Message-ID: <20000216111303.6078.qmail@web1406.mail.yahoo.com> Hello Pythoneers, After spending some time with other languages(C)I'm eager to start up Python once more.I would like to connect with some other Python beginner's(or anyone) to share ideas, build a project etc.I'm not sure where to do this(possibly through Deja.com)or just through email.I felt that I learned C much faster when I bounced ideas around and collaborated with other's.I urge anyone interested to contact me at: strat_addict@yahoo.com Thanks, G.T.Norton Let's get something started! __________________________________________________ Do You Yahoo!? Talk to your friends online with Yahoo! Messenger. http://im.yahoo.com From alan.gauld@bt.com Wed Feb 16 17:48:30 2000 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Wed, 16 Feb 2000 17:48:30 -0000 Subject: [Tutor] On top of my last message.. Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB202DF604B@mbtlipnt02.btlabs.bt.co.uk> > However, I still don't know how to make something print > without adding spaces between variables. Use format strings: print "%d%d%s" % (12,24,"Here it is") Should print; 1224Here it is > Nor do I know how to clear a screen (I just printed a bunch > of lines in my first program!) Umm, thats actually quite hard! On a PC you can be sure of the display equipment and so its easy but when you go multi platform - like python you have to cope with lots of different way to clear the screen - what does that mean on a Mac or in BeOS exactly?! Even in unix theres a plethora of terminal types and you would have to read the terminal database to identify the correct codes etc. Unless your desparate I'd stick to writing lots of lines! The other approach is move the code to a GUI framework like Tkinter. Its probably easier than trying to write platform independant terminal hanbdling IMHO! > , nor do I know how to use the equivalent of the gotoxy Again that's platform dependant. Indeed on some terminals the functionality just isn't there! Consider what X and Y mean on different platforms - character positions(as in DOS) or pixels? If you are programming using Pythonwin on a PC under windows you can do GoToXY using the Windows API but it uses pixels within the current window... Alan G. From emack@glade.net Wed Feb 16 18:47:49 2000 From: emack@glade.net (emack) Date: Wed, 16 Feb 2000 12:47:49 -0600 Subject: [Tutor] tutor 3.2 Message-ID: <011901bf78ae$53c00900$a0b04c3f@oemcomputer> This is a multi-part message in MIME format. ------=_NextPart_000_0116_01BF787C.082B5A80 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I'm a beginner [don't know anything about "C"} and i read in 3.2 of the = tutorial "The standard comparison operators are written the same as in = C: <, >, =3D=3D, <=3D, >=3D and !=3D. " I'm guessing that !=3D means = "is not equal to". Is that correct? Of course i'll find out if/when i = see it used, maybe. regards,=20 abu ------=_NextPart_000_0116_01BF787C.082B5A80 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
I'm a beginner [don't know anything about = "C"} and i=20 read in 3.2 of the tutorial "The standard comparison operators are = written the=20 same as in C: <, >, =3D=3D, <=3D, >=3D and !=3D. "  I'm = guessing that !=3D=20 means "is not equal to". Is that correct?  Of course i'll find out = if/when=20 i see it used, maybe.
regards,
abu
------=_NextPart_000_0116_01BF787C.082B5A80-- From deirdre@deirdre.net Wed Feb 16 19:03:07 2000 From: deirdre@deirdre.net (Deirdre Saoirse) Date: Wed, 16 Feb 2000 11:03:07 -0800 (PST) Subject: [Tutor] tutor 3.2 In-Reply-To: <011901bf78ae$53c00900$a0b04c3f@oemcomputer> Message-ID: On Wed, 16 Feb 2000, emack wrote: > I'm a beginner [don't know anything about "C"} and i read in 3.2 of the > tutorial "The standard comparison operators are written the same as in > C: > <, >, ==, <=, >= and !=. " I'm guessing that != means "is not equal > to". Is that correct? Of course i'll find out if/when i see it used, > maybe. Yes, exactly. != means not equal to. -- _Deirdre * http://www.linuxcabal.net * http://www.deirdre.net "Mars has been a tough target" -- Peter G. Neumann, Risks Digest Moderator "That's because the Martians keep shooting things down." -- Harlan Rosenthal , retorting in Risks Digest 20.60 From warren@nightwares.com Wed Feb 16 19:07:02 2000 From: warren@nightwares.com (Warren 'The Howdy Man' Ockrassa) Date: Wed, 16 Feb 2000 13:07:02 -0600 Subject: [Tutor] tutor 3.2 References: <011901bf78ae$53c00900$a0b04c3f@oemcomputer> Message-ID: <38AAF556.5D3431C7@nightwares.com> > emack wrote: > I'm guessing that != means "is not equal to". Is that correct? Yes. --WthmO From cleber@gibraltar.com.br Wed Feb 16 20:09:34 2000 From: cleber@gibraltar.com.br (Cleber Dantas Silva) Date: Wed, 16 Feb 2000 17:09:34 -0300 Subject: [Tutor] Web Server Message-ID: <001301bf78b9$c8e4e470$022aa8c0@mystation.com> Hello, I work in a auction site in Brazil, and I´m doing tests with python in the server. I need an information about the python and IIS... If I download the Python 1.5, I need other software to call a file ".py" in a HTML file ? Like "
" ... I work with IIS and ASP ... I need the Bobo or Medusa ? Thank´s Cleber From Gerrit Wed Feb 16 19:38:27 2000 From: Gerrit (Gerrit Holl) Date: Wed, 16 Feb 2000 20:38:27 +0100 Subject: [Tutor] tutor 3.2 In-Reply-To: <011901bf78ae$53c00900$a0b04c3f@oemcomputer>; from emack@glade.net on Wed, Feb 16, 2000 at 12:47:49PM -0600 References: <011901bf78ae$53c00900$a0b04c3f@oemcomputer> Message-ID: <20000216203827.A2935@stopcontact.palga.uucp> emack wrote on 950701669: > I'm a beginner [don't know anything about "C"} and i read in 3.2 of the tutorial "The standard comparison operators are written the same as in C: <, >, ==, <=, >= and !=. " I'm guessing that != means "is not equal to". Is that correct? Of course i'll find out if/when i see it used, maybe. > regards, > abu Abu, if you wan't to know what something does, you should really just try it out! Start your Python interpreter, and type it in! What happens if you type in "a != b"? You get a NameError. But if you type in "1 != 2", you get '1'! And if you type "1 != [", You get a SyntaxError! Learning to program is really just trying things about, especially with Python! regards, Gerrit. -- cat: /home/gerrit/.signature: No such file or directory From emack@glade.net Wed Feb 16 20:25:55 2000 From: emack@glade.net (emack) Date: Wed, 16 Feb 2000 14:25:55 -0600 Subject: [Tutor] try it Message-ID: <01a501bf78bc$078366a0$a0b04c3f@oemcomputer> This is a multi-part message in MIME format. ------=_NextPart_000_01A2_01BF7889.BC28B3E0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable >if you wan't to know what something does, you should really just >try it out! Start your Python interpreter, and type it in!=20 >regards, >Gerrit. Gerrit- Great idea. Next time I'll do that. Thanks, abu PS: Thanks to you all! ------=_NextPart_000_01A2_01BF7889.BC28B3E0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
>if you wan't to know what something does, = you=20 should really just
>try it out! Start your Python interpreter, and = type it=20 in!
>regards,
>Gerrit.

Gerrit-
Great idea. Next time I'll do = that.
Thanks,
abu
PS: Thanks to you = all!
------=_NextPart_000_01A2_01BF7889.BC28B3E0-- From Moshe Zadka Wed Feb 16 22:03:23 2000 From: Moshe Zadka (Moshe Zadka) Date: Thu, 17 Feb 2000 00:03:23 +0200 (IST) Subject: [Tutor] tutor 3.2 In-Reply-To: <011901bf78ae$53c00900$a0b04c3f@oemcomputer> Message-ID: On Wed, 16 Feb 2000, emack wrote: > I'm a beginner [don't know anything about "C"} and i read in 3.2 of the > tutorial "The standard comparison operators are written the same as in C: > <, >, ==, <=, >= and !=. " I'm guessing that != means "is not equal > to". Is that correct? Of course i'll find out if/when i see it used, > maybe. > regards, > abu Yes, != is not equal. You can also use <>, but it's less popular. Note that == is the equality operator, not =, which is assignment. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From JRhodes@brightoptions.com Wed Feb 16 22:30:56 2000 From: JRhodes@brightoptions.com (Joe Rhodes) Date: Wed, 16 Feb 2000 17:30:56 -0500 Subject: [Tutor] Coming back to Python Message-ID: <6BD56A704B9CD311A96E0090278613601279E0@BOPGWY> I would be interested in this "team learning" that you suggest. I have no coding experience at all, if that matters to you. -----Original Message----- From: G. Norton [mailto:strat_addict@yahoo.com] Sent: Wednesday, February 16, 2000 6:13 AM To: tutor@python.org Subject: [Tutor] Coming back to Python Hello Pythoneers, After spending some time with other languages(C)I'm eager to start up Python once more.I would like to connect with some other Python beginner's(or anyone) to share ideas, build a project etc.I'm not sure where to do this(possibly through Deja.com)or just through email.I felt that I learned C much faster when I bounced ideas around and collaborated with other's.I urge anyone interested to contact me at: strat_addict@yahoo.com Thanks, G.T.Norton Let's get something started! __________________________________________________ Do You Yahoo!? Talk to your friends online with Yahoo! Messenger. http://im.yahoo.com _______________________________________________ Tutor maillist - Tutor@python.org http://www.python.org/mailman/listinfo/tutor From skip@mojam.com (Skip Montanaro) Thu Feb 17 17:40:41 2000 From: skip@mojam.com (Skip Montanaro) (Skip Montanaro) Date: Thu, 17 Feb 2000 11:40:41 -0600 (CST) Subject: [Tutor] tutor 3.2 In-Reply-To: References: <011901bf78ae$53c00900$a0b04c3f@oemcomputer> Message-ID: <14508.12953.701914.800646@beluga.mojam.com> Moshe> Yes, != is not equal. You can also use <>, but it's less popular. I believe <> will be deprecated in the 1.6 release. I sent a patch for the tutorial to python-doc that gives brief definitions of the various relational operators. Skip Montanaro | http://www.mojam.com/ skip@mojam.com | http://www.musi-cal.com/ "Languages that change by catering to the tastes of non-users tend not to do so well." - Doug Landauer From nothingisgoingtochangemyworld@yahoo.com Fri Feb 18 18:27:59 2000 From: nothingisgoingtochangemyworld@yahoo.com (Joseph Stubenrauch) Date: Fri, 18 Feb 2000 10:27:59 -0800 (PST) Subject: [Tutor] A few newbie questions ... Message-ID: <20000218182759.5595.qmail@web1905.mail.yahoo.com> Hello, I am new to programming and brand new to Python and, of course, I have a few questions. Thanks in advance for any help you can offer and bear with my ignorance! 1. Can someone point me to the module (if it exists) that would allow me to do such C++ type things as clearscreen, change the background/foreground colors, and especially, a python equivalent of C++'s gotoxy. 2. Is it possible to have input be either a string or number, depending on what the user inputs? In other words, I would like to create a menu with options #1-4, and option X and Q to quit. Is that possible? I would love any help you can offer. I just downloaded python two days ago and I am LOVING it! Thanks again, joe __________________________________________________ Do You Yahoo!? Talk to your friends online with Yahoo! Messenger. http://im.yahoo.com From deirdre@deirdre.net Fri Feb 18 18:36:15 2000 From: deirdre@deirdre.net (Deirdre Saoirse) Date: Fri, 18 Feb 2000 10:36:15 -0800 (PST) Subject: [Tutor] A few newbie questions ... In-Reply-To: <20000218182759.5595.qmail@web1905.mail.yahoo.com> Message-ID: On Fri, 18 Feb 2000, Joseph Stubenrauch wrote: > 1. Can someone point me to the module (if it exists) > that would allow me to do such C++ type things as > clearscreen, change the background/foreground colors, > and especially, a python equivalent of C++'s gotoxy. Typically, that's a function of the terminal. You don't say what you're using (Unix or ?), but in Unix that's a function of curses. > 2. Is it possible to have input be either a string or > number, depending on what the user inputs? In other > words, I would like to create a menu with options > #1-4, and option X and Q to quit. Is that possible? You can try and convert a string to a number and assume it's a string if that fails: a = "foo" try: b = int(a) except: b = a print b > I would love any help you can offer. I just > downloaded python two days ago and I am LOVING it! Cool! -- _Deirdre * http://www.linuxcabal.net * http://www.deirdre.net "Mars has been a tough target" -- Peter G. Neumann, Risks Digest Moderator "That's because the Martians keep shooting things down." -- Harlan Rosenthal , retorting in Risks Digest 20.60 From Moshe Zadka Fri Feb 18 18:38:20 2000 From: Moshe Zadka (Moshe Zadka) Date: Fri, 18 Feb 2000 20:38:20 +0200 (IST) Subject: [Tutor] A few newbie questions ... In-Reply-To: <20000218182759.5595.qmail@web1905.mail.yahoo.com> Message-ID: On Fri, 18 Feb 2000, Joseph Stubenrauch wrote: > 1. Can someone point me to the module (if it exists) > that would allow me to do such C++ type things as > clearscreen, change the background/foreground colors, > and especially, a python equivalent of C++'s gotoxy. On UNIX, you have the curses module. Have a look at the win32 extensions for windows. -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From alan.gauld@bt.com Fri Feb 18 17:16:26 2000 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Fri, 18 Feb 2000 17:16:26 -0000 Subject: [Tutor] tutor 3.2 Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB202DF605A@mbtlipnt02.btlabs.bt.co.uk> > Moshe> Yes, != is not equal. You can also use <>, but > it's less popular. > > I believe <> will be deprecated in the 1.6 release. Ooh I hope not, I always use <> in my own code - I'm an ex Pascal programmer at heart :-) Alan g. From louie1@adelphia.net Fri Feb 18 19:39:42 2000 From: louie1@adelphia.net (Luis) Date: Fri, 18 Feb 2000 14:39:42 -0500 Subject: [Tutor] Please take me off the List Message-ID: <000d01bf7a47$e7f011c0$5843fea9@dad.adelphia.net> This is a multi-part message in MIME format. ------=_NextPart_000_000A_01BF7A1D.FE616820 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable i would like to be taken of the list please, can you please help me in = doing so thank you, Louie Louie1@adelphia.net ------=_NextPart_000_000A_01BF7A1D.FE616820 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
i would like to be taken of the list = please, can=20 you please help me in doing so
thank you,
Louie
Louie1@adelphia.net
------=_NextPart_000_000A_01BF7A1D.FE616820-- From alan.gauld@bt.com Mon Feb 21 11:15:07 2000 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Mon, 21 Feb 2000 11:15:07 -0000 Subject: [Tutor] A few newbie questions ... Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB202DF605B@mbtlipnt02.btlabs.bt.co.uk> > 1. Can someone point me to the module (if it exists) > that would allow me to do such C++ type things as > clearscreen, change the background/foreground colors, > and especially, a python equivalent of C++'s gotoxy. None of these are C++ things - the C++ standard library doesn't do any of them - they are typically PC things (in fact DOS things). These are possible in an exclusively DOS world because you know what kind of hardware you will be using. Python is multi platform and doesn't know whether the terminal even has a screen, far less how to clear it. Similarly it may not be able to show colors etc. On unix there is a module called curses that does that for you within the limits of an ASCII display. But what happens inside a GUI window? What does gotoXY mean - pixels or character opositions?.. On windows there is a python module pythonwin that gives you access to the Win32 API, but thats quite hard to use for a beginner. I'd suggest moving your code to Tkinter - which works on unix, mac and PC. You can see some examples on my online tutor(see Event Driven programming and the case study) http://www.crosswinds.net/~agauld/ > 2. Is it possible to have input be either a string or > number, depending on what the user inputs? In other > words, I would like to create a menu with options > #1-4, and option X and Q to quit. Is that possible? Yes, just use raw_input and compare character values: from sys import exit def func1(): print "func1" MenuItem = { '1': func1, '2': func1, '3':func1, '4':func1, 'Q':exit, 'X':exit } options = MenuItem.keys() resp = raw_input("prompt") if resp in options: MenuItem[resp]() else: print "Invalid choice" Should do it. Alan G. From wesc@alpha.ece.ucsb.edu Fri Feb 18 22:07:43 2000 From: wesc@alpha.ece.ucsb.edu (Wesley J. Chun) Date: Fri, 18 Feb 2000 14:07:43 -0800 (PST) Subject: [Tutor] A few newbie questions ... Message-ID: <200002182207.OAA04670@alpha.ece.ucsb.edu> > Date: Fri, 18 Feb 2000 10:36:15 -0800 (PST) > From: Deirdre Saoirse > > On Fri, 18 Feb 2000, Joseph Stubenrauch wrote: > > > 2. Is it possible to have input be either a string or > > number, depending on what the user inputs? In other > > words, I would like to create a menu with options > > #1-4, and option X and Q to quit. Is that possible? > > You can try and convert a string to a number and assume it's a string if > that fails: > > a = "foo" > try: > b = int(a) > except: > b = a > > print b fortunately, you have a recent version of Python. prior to 1.5, int(string) fails. if your application required backwards-compatibility to older systems (if any, it would be 1.4), you would have to use the tried- and-true string.atoi() function: C:\>python Python 1.3 (Apr 13 1996) [MSC 32 bit (Intel)] Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> int('4') Traceback (innermost last): File "", line 1, in ? TypeError: int() argument can't be converted to int >>> import string >>> string.atoi('4') 4 >>> otherwise, either way [int() or string.atoi()] would work. one suggestion i have as a side project for you is to write a "menu" function or class that helped you with text-based menu-generation. it would take a list of all items, perhaps choose a default selection (if the user just hits return, provides error messages on invalid entries, automatically generates the menu item numbers, etc. once you accomplish this, you can generically use this piece of code anywhere you have a menu-driven interface and not have to reinvent the wheel every time. hope this helps!! -wesley cyberweb.consulting :: silicon.valley, ca http://www.roadkill.com/~wesc/cyberweb/ From deirdre@deirdre.net Fri Feb 18 22:15:12 2000 From: deirdre@deirdre.net (Deirdre Saoirse) Date: Fri, 18 Feb 2000 14:15:12 -0800 (PST) Subject: [Tutor] A few newbie questions ... In-Reply-To: <200002182207.OAA04670@alpha.ece.ucsb.edu> Message-ID: On Fri, 18 Feb 2000, Wesley J. Chun wrote: > fortunately, you have a recent version of Python. > > prior to 1.5, int(string) fails. Oops! You're right, I'm new to Python with 1.5. -- _Deirdre * http://www.linuxcabal.net * http://www.deirdre.net "Mars has been a tough target" -- Peter G. Neumann, Risks Digest Moderator "That's because the Martians keep shooting things down." -- Harlan Rosenthal , retorting in Risks Digest 20.60 From strat_addict@yahoo.com Mon Feb 21 19:23:39 2000 From: strat_addict@yahoo.com (G. Norton) Date: Mon, 21 Feb 2000 11:23:39 -0800 (PST) Subject: [Tutor] New Python study group Message-ID: <20000221192339.5735.qmail@web1406.mail.yahoo.com> We would like to invite anyone new to Python or programming in general to visit our new Python study group.The group was created to be a place to make friends, exchange ideas, collaborate on projects and above all, become better Python programmer's.Also, the group will hold bi-monthly or monthly meetings to discuss specific topics or to just meet and chat.(attendence is not mandatory!).People with an open mind and a desire to learn are urged to join. With that said,the following is not allowed: No flaming. Any posted question related to hacking (e.g. cracking) will be ignored!. No spamming. Our address is: http://python-studies-subscribe@egroups.com or for more information, drop a line to: strat_addict@yahoo.com Hope to see you there. __________________________________________________ Do You Yahoo!? Talk to your friends online with Yahoo! Messenger. http://im.yahoo.com From jjgarcia@ieci.net Tue Feb 22 08:09:59 2000 From: jjgarcia@ieci.net (Juan Jose Garcia Garcia) Date: Tue, 22 Feb 2000 09:09:59 +0100 Subject: [Tutor] (no subject) Message-ID: <38B24457.285D0960@ieci.net> suscribe -- --------------------------------------------------------------------- Juan Jose Garcia INFORMATICA EL CORTE INGLES S.A. Departamento de Desarrollo de Plataformas Sectoriales Laboratorio StoreFlow Avda. de Cantabria, 51 28042 - MADRID e-mail: juanj_garcia@ieci.es Tfno: 91-329-82-00 Ext. 8442 Movil: 629-08-56-73 Fax: 91-329-54-59 --------------------------------------------------------------------- From craig@osa.att.ne.jp Tue Feb 22 13:15:28 2000 From: craig@osa.att.ne.jp (Craig Hagerman) Date: Tue, 22 Feb 2000 22:15:28 +0900 Subject: [Tutor] The what and why of StringVar() Message-ID: I am wondering if someone can help explain "StringVar()" to me. I was trying to write a simple program using Tkinter to take input from an Entry widget and then use a button command to pass it off to a function to do something. But I was unsuccessful in accessing the variable attached to the Entry widget itself. (I still don't understand why.) After poking about in the "DEMO's" Folder I found a demo in the "Matt" folder that allowed me to get around this problem by using StringVar(). However I don't understand why this is used, how it works or why I need it. So far I can't find any documentation either on line of in my 3 Python books (hope I didn't stupidly overlook something). Seeing as how this is a necessary way to access the Entry widget variable I would like to understand it. I thought that perhaps this method is part of the string module (since Matt's script imports that module, and dir(string) shows StringVar being a method) but it works without importing the string module. Any help would be appreciated. I will copy Matt's example script below minus comments so that you can see what I am talking about. Craig Hagerman -----Matt's entry-with-shared-variable.py script----- from Tkinter import * import string # This program shows how to make a typein box shadow a program variable. class App(Frame): def __init__(self, master=None): Frame.__init__(self, master) self.pack() self.entrythingy = Entry(self) self.entrythingy.pack() self.button = Button(self, text="Uppercase The Entry", command=self.upper) self.button.pack() self.contents = StringVar() self.contents.set("this is a variable") self.entrythingy.config(textvariable=self.contents) self.entrythingy.bind('', self.print_contents) def upper(self): str = string.upper(self.contents.get()) self.contents.set(str) def print_contents(self, event): print "hi. contents of entry is now ---->", self.contents.get() root = App() root.master.title("Foo") root.mainloop() From JeremyHo@flashcom.com Tue Feb 22 15:22:37 2000 From: JeremyHo@flashcom.com (Jeremy Howard) Date: Tue, 22 Feb 2000 07:22:37 -0800 Subject: [Tutor] Question about output parameters Message-ID: <29E02FADFCBBD311B24E0008C75B936E0C7DCB@west8.hb.flashcom.com> This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01BF7D48.A6A43F44 Content-Type: text/plain; charset="iso-8859-1" Hello all, I've got a question regarding Python and the way it handles output parameters. Here is the code I'm using..... >>> import win32com.client >>> objSiebel = win32com.client.Dispatch("SiebelDataServer.ApplicationObject") >>> err = 0 >>> conf = "C:\\Siebel\\bin\\psblprd.cfg" >>> objSiebel.LoadObjects(conf, err) when I fire off the last line I get this error.... Traceback (innermost last): File "", line 0, in ? File "", line 2, in LoadObjects com_error: (-2147352571, 'Type mismatch.', None, 2) the LoadObjects Function requires two parameters the first one is the location of the config file and is a string. The Second is the value returned from the fuction and is an Integer. Anyone have any ideas on ways to get around this error. Jeremy Howard jeremyho@flashcom.com ------_=_NextPart_001_01BF7D48.A6A43F44 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Question about output parameters

Hello all,



I've got a question regarding Python = and the way it handles output parameters.  Here is the code I'm = using.....

>>> = import win32com.client
>>> = objSiebel =3D = win32com.client.Dispatch("SiebelDataServer.ApplicationObject")=
>>> err = =3D 0
>>> conf = =3D "C:\\Siebel\\bin\\psblprd.cfg"
>>> = objSiebel.LoadObjects(conf, err)

when I fire off the last line I get = this error....

Traceback = (innermost last):
  File = "<interactive input>", line 0, in ?
  File = "<COMObject SiebelDataServer.ApplicationObject>", line = 2, in LoadObjects
com_error: = (-2147352571, 'Type mismatch.', None, 2)

the LoadObjects Function requires two = parameters the first one is the location of the config file and is a = string.  The Second is the value returned from the fuction and is = an Integer.  Anyone have any ideas on ways to get around this = error.

Jeremy Howard
jeremyho@flashcom.com


------_=_NextPart_001_01BF7D48.A6A43F44-- From Gtnorton64@aol.com Tue Feb 22 16:49:39 2000 From: Gtnorton64@aol.com (Gtnorton64@aol.com) Date: Tue, 22 Feb 2000 11:49:39 EST Subject: [Tutor] Python Study Group/URL Message-ID: <78.1ca2514.25e41823@aol.com> If you were interested in the study group and had trouble with the url, I apologize. Try this one : http://www.egroups.com/group/python-studies/info.html Regards, G.T. Norton From JeremyHo@flashcom.com Tue Feb 22 16:53:03 2000 From: JeremyHo@flashcom.com (Jeremy Howard) Date: Tue, 22 Feb 2000 08:53:03 -0800 Subject: [Tutor] FW: Question about output parameters Message-ID: <29E02FADFCBBD311B24E0008C75B936E0C7DCC@west8.hb.flashcom.com> This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01BF7D55.490CE61C Content-Type: text/plain; charset="iso-8859-1" > -----Original Message----- > From: Jeremy Howard > Sent: Tuesday, February 22, 2000 7:23 AM > To: 'tutor@python.org' > Subject: Question about output parameters > > Hello all, > > > > I've got a question regarding Python and the way it handles output > parameters. Here is the code I'm using..... > > >>> import win32com.client > >>> objSiebel = > win32com.client.Dispatch("SiebelDataServer.ApplicationObject") > >>> err = 0 > >>> conf = "C:\\Siebel\\bin\\psblprd.cfg" > >>> objSiebel.LoadObjects(conf, err) > > when I fire off the last line I get this error.... > > Traceback (innermost last): > File "", line 0, in ? > File "", line 2, in > LoadObjects > com_error: (-2147352571, 'Type mismatch.', None, 2) > > the LoadObjects Function requires two parameters the first one is the > location of the config file and is a string. The Second is the value > returned from the fuction and is an Integer. Anyone have any ideas on > ways to get around this error. > > Jeremy Howard > jeremyho@flashcom.com > > ------_=_NextPart_001_01BF7D55.490CE61C Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable FW: Question about output parameters

 -----Original Message-----
From:   Jeremy Howard 
Sent:   = Tuesday, February 22, 2000 7:23 = AM
To:     'tutor@python.org'
Subject:        Question about output parameters =

Hello all,



I've got a question regarding Python = and the way it handles output parameters.  Here is the code I'm = using.....

>>> = import win32com.client
>>> = objSiebel =3D = win32com.client.Dispatch("SiebelDataServer.ApplicationObject")=
>>> err = =3D 0
>>> conf = =3D "C:\\Siebel\\bin\\psblprd.cfg"
>>> = objSiebel.LoadObjects(conf, err)

when I fire off the last line I get = this error....

Traceback = (innermost last):
  File = "<interactive input>", line 0, in ?
  File = "<COMObject SiebelDataServer.ApplicationObject>", line = 2, in LoadObjects
com_error: = (-2147352571, 'Type mismatch.', None, 2)

the LoadObjects Function requires two = parameters the first one is the location of the config file and is a = string.  The Second is the value returned from the fuction and is = an Integer.  Anyone have any ideas on ways to get around this = error.

Jeremy Howard
jeremyho@flashcom.com


------_=_NextPart_001_01BF7D55.490CE61C-- From chedr@voicenet.com Wed Feb 23 20:25:18 2000 From: chedr@voicenet.com (chedr) Date: Wed, 23 Feb 2000 15:25:18 -0500 Subject: [Tutor] 'text editor' Message-ID: <38B4422E.47929FF4@voicenet.com> Hi, I'm totaly new at this so bear with me. Where do I get a text editor? This is what I've done so far: Downloaded and installed py152.exe; Downloaded but haven't installed win32all.exe build 125; bought a copy of "Learning Python" by Mark Lutz; got to page 13 where it says "suppose we start our favorite text editor". Do I have a text editor and don't know it? Help! Thanks, Chet From DOUGS@oceanic.com Wed Feb 23 20:42:03 2000 From: DOUGS@oceanic.com (Doug Stanfield) Date: Wed, 23 Feb 2000 10:42:03 -1000 Subject: [Tutor] 'text editor' Message-ID: <5650A1190E4FD111BC7E0000F8034D26A0F30D@huina.oceanic.com> I'm assuming since you've downloaded the win32all.exe that you use a Windows platform. In future that kind of information can help us to answer your questions. Any word processor is a text editor so you have several to choose from; notepad, word pad, or even MS Word. I wouldn't necessarily recommend any of those for programming Python though. Based on the above assumption, you should know that the Windows install of Python has a very good development system that includes an editor written in Python by the languages founder. If you look in the directories that were installed by the Python installer you'll find 'Tools' with a subdirectory 'idle'. Within that directory is the executable idle.pyw. Start that executable in any of the usual ways and you'll have a Python shell to play in. Its the best place to learn the use of new functionality. Use the 'File' menu to open a 'New Window', and you'll have not just a text editor, but a Python editor with keyword colorizing and automatic indentation among other things. HTH, -Doug- > -----Original Message----- > From: chedr [mailto:chedr@voicenet.com] > Sent: Wednesday, February 23, 2000 10:25 AM > To: tutor@python.org > Subject: [Tutor] 'text editor' > > > Hi, > I'm totaly new at this so bear with me. > Where do I get a text editor? > This is what I've done so far: Downloaded and installed py152.exe; > Downloaded but haven't installed win32all.exe build 125; > bought a copy > of "Learning Python" by Mark Lutz; got to page 13 where it says > "suppose we start our favorite text editor". > Do I have a text editor and don't know it? Help! > Thanks, > Chet > > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://www.python.org/mailman/listinfo/tutor > From bwinton@tor.dhs.org Wed Feb 23 21:34:38 2000 From: bwinton@tor.dhs.org (Blake Winton) Date: Wed, 23 Feb 2000 16:34:38 -0500 Subject: [Tutor] 'text editor' In-Reply-To: <5650A1190E4FD111BC7E0000F8034D26A0F30D@huina.oceanic.com> References: <5650A1190E4FD111BC7E0000F8034D26A0F30D@huina.oceanic.com> Message-ID: <00022316382600.31301@tor.dhs.org> On Wed, 23 Feb 2000, Doug Stanfield wrote: > Any word processor is a text editor so you have several to > choose from; notepad, word pad, or even MS Word. I wouldn't necessarily > recommend any of those for programming Python though. I dunno, Notepad isn't all that bad for editing Python... :) > Based on the above assumption, you should know that the Windows > install of Python has a very good development system that includes > an editor written in Python by the languages founder. If you look > in the directories that were installed by the Python installer > you'll find 'Tools' with a subdirectory 'idle'. Within that > directory is the executable idle.pyw. As a side note, I believe that when you install Python in Windows, it puts a link to Idle in the start menu (i.e. Start >> Programs >> Python >> Idle) And that might be a better way to get to it than looking through the file system, especially for someone who's starting Python, and might not know how to run a .pyw file. Just a thought, Blake. -- 12:21pm up 16 days, 17:56, 0 users, load average: 7.08, 7.02, 7.01 From ecogburn@greene.xtn.net Wed Feb 23 21:54:44 2000 From: ecogburn@greene.xtn.net (Ed Cogburn) Date: Wed, 23 Feb 2000 21:54:44 +0000 Subject: [Tutor] 'text editor' References: <38B4422E.47929FF4@voicenet.com> Message-ID: <38B45724.255000BA@greene.xtn.net> chedr wrote: > > Hi, > I'm totaly new at this so bear with me. > Where do I get a text editor? > This is what I've done so far: Downloaded and installed py152.exe; > Downloaded but haven't installed win32all.exe build 125; bought a copy > of "Learning Python" by Mark Lutz; got to page 13 where it says > "suppose we start our favorite text editor". > Do I have a text editor and don't know it? Help! I haven't worked any on MSWin in awhile since using Linux, but there is a wonderful text editor, freely available, for the Windows world called "Programmer's File Editor" or "pfe". The last time I went looking for it, its home page was: http://www.lancs.ac.uk/people/cpaap/pfe/ -- "It is dangerous to be right when the government is wrong." - Voltaire Ed C. From Brian.Lamarche@pnl.gov Wed Feb 23 22:11:12 2000 From: Brian.Lamarche@pnl.gov (Lamarche, Brian L) Date: Wed, 23 Feb 2000 14:11:12 -0800 Subject: [Tutor] FW: Menu Bars and Entry config Message-ID: ---------- From: Lamarche, Brian L Sent: Wednesday, February 23, 2000 2:09 PM To: 'tutors@python.org' Subject: Menu Bars and Entry config Help, I have created a GUI and I would like to use menus to open files and close them etc... My program is user specific so I would like to add a feature where once I open a file I can not open any more. Thus I want to disable a command menu button. command = command menu bar 0 is the place FileOpen is in the menu and Disabled is what I want to make it command.entryconfig(0,state=DISABLED) Can you help me on this or any other Tkinter problems....? Thanks, Brian From cfking@cybermail.net Thu Feb 24 01:14:14 2000 From: cfking@cybermail.net (cfking@cybermail.net) Date: Thu, 24 Feb 2000 02:14:14 +0100 Subject: [Tutor] telnetlib problem (interact, maybe due to Win32) Message-ID: <38B485E6.A3826E51@cybermail.net> Hello, thank you for running this service. To not make too many words: I'm trying to automate some nasty plain-ascii telnet app with telnetlib. So far so good, but it seems that interact() doesn't work. Is that a feature of my environment or am I using it the wrong way? I'm starting to use Python on Win32, plain vanilla 1.5.2 installer installation so far, trying to get going quickly. Could you provide or point me to a small example using interact() or a technique that simulates it ? I'm not subscribed to any mailing list yet so a direct reply would be great Thanks a lot Christian Frederking, Germany cfking@cybermail.net From cfking@cybermail.net Thu Feb 24 01:00:48 2000 From: cfking@cybermail.net (cfking@cybermail.net) Date: Thu, 24 Feb 2000 02:00:48 +0100 Subject: [Tutor] basic IDLE and other difficulties Message-ID: <38B482C0.712D230A@cybermail.net> Hello, thank you for running this service. To not make too many words: I'm starting to use Python on Win32, plain vanilla 1.5.2 installer installation so far. I've been doing the tutorial by Guido, PC-wise based on IDLE. I'm stuck in chapter 6: --> just how do I make IDLE take the same thing for the "current" (or desired current) directory as I do? (I don't want to have to keep putting things in the midst of ...Python/Lib) --> how do I say "change directory" in Python, anyway? I've found "getcwd()" (after a considerable amount of digging), but in all of the FAQ and the docs I've found nothing similar to "setcwd()" or just simply "cd()". os wasn't easy, I don't think I got it all right. --> how do I make IDLE acknowledge that I have *changed* a file in my favorite editor (or even in the IDLE builtin editor) after the first "from myfile import ..." ? IDLE seem just barely too stubborn to see my changes. Keep quitting and restarting?? --> Is there any such thing as an "unimport()" or "forget()" anyway? Sorry I'm not posting these questions to comp.lang.python. I feel I'm just too new to the group yet to do a post. Feel free to (anonymize and) post (with answers;) or faq them if you like. Reply would be great Thanks a lot Christian Frederking, Germany cfking@cybermail.net From tgabriel@bellsouth.net Thu Feb 24 03:32:30 2000 From: tgabriel@bellsouth.net (tgabriel@bellsouth.net) Date: Wed, 23 Feb 2000 22:32:30 -0500 Subject: [Tutor] 'text editor' References: <38B4422E.47929FF4@voicenet.com> Message-ID: <38B4A64D.7491FB22@bellsouth.net> install the windows program and go to the proper directory and run python. it is your t e. Alternatively, open notepad, type your program, save it as xxxxx.py open python and get the file you created and run it. From Moshe Zadka Thu Feb 24 07:26:55 2000 From: Moshe Zadka (Moshe Zadka) Date: Thu, 24 Feb 2000 09:26:55 +0200 (IST) Subject: [Tutor] 'text editor' In-Reply-To: <38B4422E.47929FF4@voicenet.com> Message-ID: On Wed, 23 Feb 2000, chedr wrote: > Hi, > I'm totaly new at this so bear with me. > Where do I get a text editor? > This is what I've done so far: Downloaded and installed py152.exe; > Downloaded but haven't installed win32all.exe build 125; bought a copy > of "Learning Python" by Mark Lutz; got to page 13 where it says > "suppose we start our favorite text editor". > Do I have a text editor and don't know it? Help! Yes! You have at least three, of which two are espcially suited to Python: PythonWin and IDLE. Both are available from the "start" menu, in the Python group. From dworkin@ccs.neu.edu Thu Feb 24 15:55:49 2000 From: dworkin@ccs.neu.edu (Justin Sheehy) Date: 24 Feb 2000 10:55:49 -0500 Subject: [Tutor] basic IDLE and other difficulties In-Reply-To: "cfking@cybermail.net"'s message of "Thu, 24 Feb 2000 02:00:48 +0100" References: <38B482C0.712D230A@cybermail.net> Message-ID: "cfking@cybermail.net" writes: > --> how do I say "change directory" in Python, anyway? os.chdir(path) > --> Is there any such thing as an "unimport()" or "forget()" anyway? Net really, but depending on what you want, 'del ' may help. -Justin From alan.gauld@bt.com Fri Feb 25 10:41:36 2000 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Fri, 25 Feb 2000 10:41:36 -0000 Subject: [Tutor] basic IDLE and other difficulties Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB202DF607A@mbtlipnt02.btlabs.bt.co.uk> > --> just how do I make IDLE take the same thing for the "current" > (or desired current) directory as I do? (I don't want to have to > keep putting things in the midst of ...Python/Lib) Look at the PYTHONPATH environme t variable - set it up in your AUTOEXEC.BAT file to point to the directory(s) where you store your own modules then reboot. From then on Python will look first in iyts own libraries then in yours for a module. I think that's really what you want? > --> how do I make IDLE acknowledge that I have *changed* a file > in my favorite editor (or even in the IDLE builtin editor) after > the first "from myfile import ..." ? IDLE seem just barely > too stubborn to see my changes. Keep quitting and restarting?? Try issueing a 'reload'. I'm not sure if/where it is in IDLE but theres definitely a menu version on Pythonwin. BUT It only works if you used import foo not if you did from foo import * In the latter case you will have to quit/restart. (unless somebody else knows a better way???) FWIW I usually run IDLE as a development environment but keep a DOS box open to run the programs - IDLE has some bugs around raw_input() and input() and a few other issues. Thus I use Ctrl-S to sabe then run the program in the DOS box: F3 > Sorry I'm not posting these questions to comp.lang.python. Thats OK this forum is for exactly these types of questions. Alan G. From harun27@hotmail.com Fri Feb 25 20:02:52 2000 From: harun27@hotmail.com (HARUN F.ABDULHAQ) Date: Fri, 25 Feb 2000 20:02:52 EAT Subject: [Tutor] (no subject) Message-ID: <20000225170252.56150.qmail@hotmail.com> HI, Which book should i get to learn Python programming language(beginner) thanks harun ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com From ivanlan@callware.com Fri Feb 25 17:21:36 2000 From: ivanlan@callware.com (Ivan Van Laningham) Date: Fri, 25 Feb 2000 10:21:36 -0700 Subject: [Tutor] (no subject) References: <20000225170252.56150.qmail@hotmail.com> Message-ID: <38B6BA20.EB977CCD@callware.com> Hi, Harun-- "HARUN F.ABDULHAQ" wrote: > > HI, > > Which book should i get to learn Python programming language(beginner) > If you have some programming experience already, the best choice (and available right now) is David Ascher & Mark Lutz' _Learning Python_ from O'Reilly. If you have no programming experience, you can wait till the end of March for my book, _Teach Yourself Python in 24 Hours_, which is meant explicitly for those who are complete beginners in programming and Python. By following this link, you go to the Python Software Activity's Bookstore, and they get a small percentage if you buy the book by clicking on their links: http://www.python.org/psa/bookstore/ -ly y'rs, Ivan ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. ivanlan@callware.com http://www.pauahtun.org http://www.foretec.com/python/workshops/1998-11/proceedings.html Army Signal Corps: Cu Chi, Class of '70 Author: Teach Yourself Python in 24 Hours From deirdre@deirdre.net Fri Feb 25 18:53:55 2000 From: deirdre@deirdre.net (Deirdre Saoirse) Date: Fri, 25 Feb 2000 10:53:55 -0800 (PST) Subject: [Tutor] (no subject) In-Reply-To: <38B6BA20.EB977CCD@callware.com> Message-ID: On Fri, 25 Feb 2000, Ivan Van Laningham wrote: > If you have no programming experience, you can wait till the end of > March for my book, _Teach Yourself Python in 24 Hours_, which is meant > explicitly for those who are complete beginners in programming and > Python. I was wondering when that book was going to surface. Thanks for the update. -- _Deirdre * http://www.linuxcabal.net * http://www.deirdre.net "That doesn't make sense in any meaning of 'sense' with which I'm familiar" -- Aaron Malone From genius@idirect.com Fri Feb 25 18:57:57 2000 From: genius@idirect.com (Snoopy :-))) Date: Fri, 25 Feb 2000 13:57:57 -0500 Subject: [Tutor] (no subject) References: <20000225170252.56150.qmail@hotmail.com> <38B6BA20.EB977CCD@callware.com> Message-ID: <38B6D0B5.2C7C1D89@idirect.com> Ivan Van Laningham wrote: > Hi, Harun-- > > "HARUN F.ABDULHAQ" wrote: > > > > HI, > > > > Which book should i get to learn Python programming language(beginner) > > > > If you have some programming experience already, the best choice (and > available right now) is David Ascher & Mark Lutz' _Learning Python_ from > O'Reilly. > > If you have no programming experience, you can wait till the end of > March for my book, _Teach Yourself Python in 24 Hours_, which is meant > explicitly for those who are complete beginners in programming and > Python. > > By following this link, you go to the Python Software Activity's > Bookstore, and they get a small percentage if you buy the book by > clicking on their links: > > http://www.python.org/psa/bookstore/ > > -ly y'rs, > Ivan > ---------------------------------------------- > Ivan Van Laningham > Callware Technologies, Inc. > ivanlan@callware.com > http://www.pauahtun.org > http://www.foretec.com/python/workshops/1998-11/proceedings.html > Army Signal Corps: Cu Chi, Class of '70 > Author: Teach Yourself Python in 24 Hours > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://www.python.org/mailman/listinfo/tutor Hi Ivan :-)) I hope the release of this book will not be delayed again. According to my info it was supposed to be released in Sept. or Oct. 99. I bought "Learning Python" but being a Novice in Programming, (as well as a Newbie in Linux) it seems to be way above my head. So I am anxiously waiting for your book. Best regards, Charles Takacs From oceanic2000@hotmail.com Fri Feb 25 19:25:07 2000 From: oceanic2000@hotmail.com (Tiffany Olson) Date: Fri, 25 Feb 2000 11:25:07 PST Subject: [Tutor] help!!! Message-ID: <20000225192507.67577.qmail@hotmail.com> how can i learn python when everything is put into comparison terms! just tell me how to do it and i'll be able to learn it!!! *T*I*F*F*A*N*Y* ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com From warren@nightwares.com Fri Feb 25 19:34:51 2000 From: warren@nightwares.com (Warren 'The Howdy Man' Ockrassa) Date: Fri, 25 Feb 2000 13:34:51 -0600 Subject: [Tutor] help!!! References: <20000225192507.67577.qmail@hotmail.com> Message-ID: <38B6D95B.72E0AAB3@nightwares.com> Tiffany Olson wrote: > how can i learn python when everything is put into comparison terms! Well, that's one of the most convenient ways to express how it functions. Of course if you're unfamiliar with any of those other languages, you're kind of stuck... What documentation werwe you specifically having trouble with? --WthmO From ivanlan@callware.com Fri Feb 25 19:36:52 2000 From: ivanlan@callware.com (Ivan Van Laningham) Date: Fri, 25 Feb 2000 12:36:52 -0700 Subject: [Tutor] help!!! References: <20000225192507.67577.qmail@hotmail.com> Message-ID: <38B6D9D4.A221C0F8@callware.com> Hi All-- Tiffany Olson wrote: > > how can i learn python when everything is put into comparison terms! just > tell me how to do it and i'll be able to learn it!!! > Well, I guess this is my day for BSP;-) Sorry, folks. I'll just repeat what I said earlier: If you have some programming experience already, the best choice (and available right now) is David Ascher & Mark Lutz' _Learning Python_ from O'Reilly. If you have no programming experience, you can wait till the end of March for my book, _Teach Yourself Python in 24 Hours_, which is meant explicitly for those who are complete beginners in programming and Python. By following this link, you go to the Python Software Activity's Bookstore, and they get a small percentage if you buy the book by clicking on their links: http://www.python.org/psa/bookstore/ I do not expect readers to be familiar with other programming languages, so you won't find features in Python likened to features (or bugs) in other languages. > *T*I*F*F*A*N*Y* > Then you can write a book and call it _The Education of *T*I*F*F*A*N*Y*_. -ly y'rs, Ivan;-) ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. ivanlan@callware.com http://www.pauahtun.org http://www.foretec.com/python/workshops/1998-11/proceedings.html Army Signal Corps: Cu Chi, Class of '70 Author: Teach Yourself Python in 24 Hours From ivanlan@callware.com Fri Feb 25 19:19:53 2000 From: ivanlan@callware.com (Ivan Van Laningham) Date: Fri, 25 Feb 2000 12:19:53 -0700 Subject: [Tutor] (no subject) References: <20000225170252.56150.qmail@hotmail.com> <38B6BA20.EB977CCD@callware.com> <38B6D0B5.2C7C1D89@idirect.com> Message-ID: <38B6D5D9.45BCA66F@callware.com> Hi All-- "Snoopy :-))" wrote: > [snip] > Hi Ivan :-)) > I hope the release of this book will not be delayed again. According to my > info it was supposed to be released in Sept. or Oct. 99. I bought > "Learning Python" but being a Novice in Programming, (as well as a Newbie > in Linux) it seems to be way above my head. So I am anxiously waiting for > your book. > Best regards, > Charles Takacs I apologize for the delay, Charles, but I believe that TYPython will be a better book because of the extra time I took writing it. The original release date would have been November or early December 99, but because I have a full-time day job and many other committments (such as a life), it took longer. Plus, several chapters that I thought would be very short turned out to require much more attention than I had initially planned for. I do believe that it will be worth the wait, however. The book is completely done from my end; the publisher has all my last-minute corrections and there is nothing more for me to do. SAMS is pretty efficient when it comes to putting out books, so when they say that the expected release date is now March 21, I would tend to give some credibility to that date. -ly y'rs, Ivan;-) ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. ivanlan@callware.com http://www.pauahtun.org http://www.foretec.com/python/workshops/1998-11/proceedings.html Army Signal Corps: Cu Chi, Class of '70 Author: Teach Yourself Python in 24 Hours From rbl@hal.cwru.edu Fri Feb 25 19:39:37 2000 From: rbl@hal.cwru.edu (Robin B. Lake) Date: Fri, 25 Feb 2000 14:39:37 -0500 (EST) Subject: [Tutor] Need for pedestrian-level explaination Message-ID: <200002251939.OAA00446@hal.epbi.cwru.edu> Python looks great and I've already slayed a few dragons quickly and simply with it. However, the e-list postings often drop terms for which there are no simple descriptions that are easily found. I go back 25+ years with C and 40 years with some pretty arcane programming languages, and I'm worried that a neat language like Python, designed for the masses, will "off" them because it isn't simple, stupid. I.E. Zope. What is it? What hardware does it require? What good is it? CVS. ditto IDLE. ditto and so forth. Thanks, Rob lake rbl@hal.cwru.edu From python-list@teleo.net Fri Feb 25 20:01:40 2000 From: python-list@teleo.net (Patrick Phalen) Date: Fri, 25 Feb 2000 12:01:40 -0800 Subject: [Tutor] Need for pedestrian-level explaination In-Reply-To: <200002251939.OAA00446@hal.epbi.cwru.edu> References: <200002251939.OAA00446@hal.epbi.cwru.edu> Message-ID: <00022512091603.00908@quadra.teleo.net> [Robin B. Lake, on Fri, 25 Feb 2000] :: Python looks great and I've already slayed a few dragons quickly :: and simply with it. :: :: However, the e-list postings often drop terms for which there are :: no simple descriptions that are easily found. I go back 25+ years :: with C and 40 years with some pretty arcane programming languages, and :: I'm worried that a neat language like Python, designed for the masses, :: will "off" them because it isn't simple, stupid. :: :: I.E. :: :: Zope. What is it? What hardware does it require? What good is it? http://www.zope.org :: CVS. ditto http://www.python.org/download/cvs.html :: IDLE. ditto http://www.python.org/idle The Python web site has a search feature. 40 years of programming experience and you don't know how to use a search engine? ;-) From Moshe Zadka Fri Feb 25 20:18:05 2000 From: Moshe Zadka (Moshe Zadka) Date: Fri, 25 Feb 2000 22:18:05 +0200 (IST) Subject: [Tutor] Need for pedestrian-level explaination In-Reply-To: <200002251939.OAA00446@hal.epbi.cwru.edu> Message-ID: On Fri, 25 Feb 2000, Robin B. Lake wrote: > Zope.What is it? What hardware does it require? What good is it? A super-duper web server. For more, try http://www.zope.org > CVS.ditto Concurrent Versioning System: the way many Free Software (or Open Source) projects are being co-ordinated, this is a way for anyone to see the development sources. Try http://www.cyclic.org for more information. > IDLE.ditto An IDE for Python which is distributed along with the standard distribution. If you have windows, you probably installed it along with your Python. Otherwise, you'll need to download the source distribution from http://www.python.org and install it. It can do some things quite well, but it isn't commercial quality yet. > and so forth. Try http://www.google.com to search for unfamiliar terms. For Python specific ones, you can try the search engine linked from http://www.python.org -- Moshe Zadka . INTERNET: Learn what you know. Share what you don't. From ivanlan@callware.com Fri Feb 25 19:45:40 2000 From: ivanlan@callware.com (Ivan Van Laningham) Date: Fri, 25 Feb 2000 12:45:40 -0700 Subject: [Tutor] help!!! References: <20000225193932.25131.qmail@hotmail.com> Message-ID: <38B6DBE4.B6B76EF9@callware.com> Hi All-- Tiffany Olson wrote: > > How about getting free, easy help online? > That's what this list is for. Could you be more specific? Have you tried running the interpreter? Does it make any sense at all to you? -ly y'rs, Ivan ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. ivanlan@callware.com http://www.pauahtun.org http://www.foretec.com/python/workshops/1998-11/proceedings.html Army Signal Corps: Cu Chi, Class of '70 Author: Teach Yourself Python in 24 Hours From f_khayyat@yahoo.com Fri Feb 25 21:20:13 2000 From: f_khayyat@yahoo.com (f_khayyat) Date: Sat, 26 Feb 2000 00:20:13 +0300 Subject: [Tutor] (no subject) References: <20000225170252.56150.qmail@hotmail.com> <38B6BA20.EB977CCD@callware.com> <38B6D0B5.2C7C1D89@idirect.com> <38B6D5D9.45BCA66F@callware.com> Message-ID: <003301bf7fd6$23695de0$852246d4@default> Hi everybody Hi Harun if want something right now go to - Non-Programmers Tutorial For Python - at : http://www.honors.montana.edu/~jjc/easytut/easytut/ if your browser is MSIE then add this page to your favorites and choose make it avalible offline then, synchronize it with 1 link deep. I hope that you find what you looking for for now. Fawaz Khayyat ----- Original Message ----- From: Ivan Van Laningham Cc: Sent: Friday, February 25, 2000 10:19 PM Subject: Re: [Tutor] (no subject) > Hi All-- > > "Snoopy :-))" wrote: > > > [snip] > > Hi Ivan :-)) > > I hope the release of this book will not be delayed again. According to my > > info it was supposed to be released in Sept. or Oct. 99. I bought > > "Learning Python" but being a Novice in Programming, (as well as a Newbie > > in Linux) it seems to be way above my head. So I am anxiously waiting for > > your book. > > Best regards, > > Charles Takacs > > I apologize for the delay, Charles, but I believe that TYPython will be > a better book because of the extra time I took writing it. The original > release date would have been November or early December 99, but because > I have a full-time day job and many other committments (such as a life), > it took longer. Plus, several chapters that I thought would be very > short turned out to require much more attention than I had initially > planned for. > > I do believe that it will be worth the wait, however. The book is > completely done from my end; the publisher has all my last-minute > corrections and there is nothing more for me to do. SAMS is pretty > efficient when it comes to putting out books, so when they say that the > expected release date is now March 21, I would tend to give some > credibility to that date. > > -ly y'rs, > Ivan;-) > ---------------------------------------------- > Ivan Van Laningham > Callware Technologies, Inc. > ivanlan@callware.com > http://www.pauahtun.org > http://www.foretec.com/python/workshops/1998-11/proceedings.html > Army Signal Corps: Cu Chi, Class of '70 > Author: Teach Yourself Python in 24 Hours > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://www.python.org/mailman/listinfo/tutor __________________________________________________ Do You Yahoo!? Talk to your friends online with Yahoo! Messenger. http://im.yahoo.com From radien@viaccess.net Fri Feb 25 23:03:40 2000 From: radien@viaccess.net (Rory "Radien" Andrews) Date: Fri, 25 Feb 2000 19:03:40 -0400 Subject: [Tutor] new learner Message-ID: <001201bf7fe4$92e7d080$ad5afea9@radien> This is a multi-part message in MIME format. ------=_NextPart_000_000D_01BF7FC3.0726D940 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Please help me I am a beginner in the hacker field no where near being = advance with the terms and how to use programming programs is there any = information that you can give to this insolent pup it would be very well = appericated ------=_NextPart_000_000D_01BF7FC3.0726D940 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Please help me I am a beginner in the = hacker field=20 no where near being advance with the terms and how to use programming = programs=20 is there any information that you can give to this insolent pup it would = be very=20 well appericated
------=_NextPart_000_000D_01BF7FC3.0726D940-- From metafakx@yifan.net Fri Feb 25 16:00:36 2000 From: metafakx@yifan.net (david) Date: Fri, 25 Feb 2000 09:00:36 -0700 Subject: [Tutor] printf codes Message-ID: <20000225090036.A20864@yifan.net> Could someone refer me to definitions of the c printf format codes that are used in python, or define them here? Specifically, %, c, s, i, d, u, o, x, X, e, E, f, g, G. [I know what the %, d and s are for.] David From jstok@bluedog.apana.org.au Sat Feb 26 16:20:03 2000 From: jstok@bluedog.apana.org.au (Jason Stokes) Date: Sun, 27 Feb 2000 03:20:03 +1100 Subject: [Tutor] Need for pedestrian-level explaination Message-ID: <008301bf8075$58d75820$42e60ecb@jstok> >On Fri, 25 Feb 2000, Robin B. Lake wrote: > >> Zope.What is it? What hardware does it require? What good is it? > >A super-duper web server. For more, try http://www.zope.org Web server? More like a web site and web application design and publishing system. From deirdre@deirdre.net Sat Feb 26 16:23:36 2000 From: deirdre@deirdre.net (Deirdre Saoirse) Date: Sat, 26 Feb 2000 08:23:36 -0800 (PST) Subject: [Tutor] Need for pedestrian-level explaination In-Reply-To: <008301bf8075$58d75820$42e60ecb@jstok> Message-ID: On Sun, 27 Feb 2000, Jason Stokes wrote: > Web server? More like a web site and web application design and > publishing system. Yes, but it also does include a web server. I would call it an application server myself. -- _Deirdre * http://www.linuxcabal.net * http://www.deirdre.net "That doesn't make sense in any meaning of 'sense' with which I'm familiar" -- Aaron Malone From parkw@better.net Sat Feb 26 18:14:37 2000 From: parkw@better.net (William Park) Date: Sat, 26 Feb 2000 13:14:37 -0500 Subject: [Tutor] printf codes In-Reply-To: <20000225090036.A20864@yifan.net>; from metafakx@yifan.net on Fri, Feb 25, 2000 at 09:00:36AM -0700 References: <20000225090036.A20864@yifan.net> Message-ID: <20000226131437.A3505@better.net> On Fri, Feb 25, 2000 at 09:00:36AM -0700, david wrote: > > Could someone refer me to definitions of the c printf format codes > that are used in python, or define them here? Specifically, %, c, s, > i, d, u, o, x, X, e, E, f, g, G. > > [I know what the %, d and s are for.] > > David 'man -a printf' or look up any Python or C books. From billbnor@mousa.demon.co.uk Sat Feb 26 17:55:51 2000 From: billbnor@mousa.demon.co.uk (Bill Bedford) Date: Sat, 26 Feb 2000 17:55:51 +0000 Subject: [Tutor] Need for pedestrian-level explanation In-Reply-To: <008301bf8075$58d75820$42e60ecb@jstok> References: <008301bf8075$58d75820$42e60ecb@jstok> Message-ID: At 3:20 am +1100 27/02/00, Jason Stokes wrote: >>On Fri, 25 Feb 2000, Robin B. Lake wrote: >> >>> Zope.What is it? What hardware does it require? What good is it? >> >>A super-duper web server. For more, try http://www.zope.org > > >Web server? More like a web site and web application design and publishing >system. Out of interest -- does anyone know of a Zope enabled web hosting company in the UK? -- Bill Bedford mailto:billb@mousa.demon.co.uk The hippo of recollection stirred in the muddy waters of the mind. From bwarsaw@cnri.reston.va.us (Barry A. Warsaw) Sat Feb 26 20:20:54 2000 From: bwarsaw@cnri.reston.va.us (Barry A. Warsaw) (Barry A. Warsaw) Date: Sat, 26 Feb 2000 15:20:54 -0500 (EST) Subject: [Tutor] testing autoreply Message-ID: <14520.13734.90787.335517@anthem.cnri.reston.va.us> sorry tutors, please ignore. -Barry From bwarsaw@cnri.reston.va.us (Barry A. Warsaw) Sat Feb 26 20:22:41 2000 From: bwarsaw@cnri.reston.va.us (Barry A. Warsaw) (Barry A. Warsaw) Date: Sat, 26 Feb 2000 15:22:41 -0500 (EST) Subject: [Tutor] testing autoreply Message-ID: <14520.13841.563058.902955@anthem.cnri.reston.va.us> Last test; this should not autoreply. Please ignore. -Barry From f_khayyat@yahoo.com Sun Feb 27 14:08:14 2000 From: f_khayyat@yahoo.com (f_khayyat) Date: Sun, 27 Feb 2000 17:08:14 +0300 Subject: [Tutor] (no subject) References: <20000225170252.56150.qmail@hotmail.com> Message-ID: <02ce01bf812c$479a4560$482246d4@default> Hi everybody Hi Harun if want something right now go to - Non-Programmers Tutorial For Python - at : http://www.honors.montana.edu/~jjc/easytut/easytut/ if your browser is MSIE then add this page to your favorites and choose make it avalible offline then, synchronize it with 1 link deep. I hope that you find what you looking for for now. Fawaz Khayyat ----- Original Message ----- From: HARUN F.ABDULHAQ To: Sent: Friday, February 25, 2000 11:02 PM Subject: [Tutor] (no subject) > HI, > > Which book should i get to learn Python programming language(beginner) > > thanks > harun > ______________________________________________________ > Get Your Private, Free Email at http://www.hotmail.com > > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://www.python.org/mailman/listinfo/tutor __________________________________________________ Do You Yahoo!? Talk to your friends online with Yahoo! Messenger. http://im.yahoo.com From ivanlan@callware.com Sat Feb 26 14:46:26 2000 From: ivanlan@callware.com (Ivan Van Laningham) Date: Sat, 26 Feb 2000 07:46:26 -0700 Subject: [Tutor] help!!! References: <20000226143433.76125.qmail@hotmail.com> Message-ID: <38B7E742.2F81295D@callware.com> Hi All-- Tiffany Olson wrote: > > I want to learn Python from memory. Where and how can I get information > on-line to learn it? I also have no access to a group here in my town that > can help me. > Have you downloaded Python and installed it? Have you tried to run it? What kind of computer do you have (Windows? Mac? Linux?)? It's hard to help you unless you are more specific. Truly, we all would *love* to help you--just give us something to go on. An excellent online tutorial, meant explicitly for non-programmers (which I assume you are), written by Alan Gauld, is available at: http://members.xoom.com/alan_gauld/tutor/tutindex.htm That said, online documentation is not, to my mind, nearly as satisfactory as a real book. Window-switching can be fairly inconvenient, and it's harder to read stuff on the screen than it is in hardcopy. -ly y'rs, Ivan ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. ivanlan@callware.com http://www.pauahtun.org and http://www.foretec.com/python/workshops/1998-11/proceedings.html Army Signal Corps: Cu Chi, Class of '70 Author: Teach Yourself Python in 24 Hours From alan.gauld@bt.com Mon Feb 28 10:53:19 2000 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Mon, 28 Feb 2000 10:53:19 -0000 Subject: [Tutor] help!!! Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB202DF6082@mbtlipnt02.btlabs.bt.co.uk> > how can i learn python when everything is put into comparison > terms! just tell me how to do it and i'll be able to learn it!!! Not sure what you mean by that since comparison is one of the best ways of learning - its how we learn any new language, programming or otherwise. There are a couple of tutors for beginners on the Python Web site which get straight to the meat of it if that's your style. You can try m ine which is more explanatorty of concepts if your a complete beginner, but it does (deliberately) use comparisons with Tcl and QBASIC. http://www.crosswinds.net/~agauld/ Alan G. From alan.gauld@bt.com Mon Feb 28 11:18:23 2000 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Mon, 28 Feb 2000 11:18:23 -0000 Subject: [Tutor] printf codes Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB202DF6084@mbtlipnt02.btlabs.bt.co.uk> > Could someone refer me to definitions of the c printf format codes > that are used in python, or define them here? Specifically, %, c, s, > i, d, u, o, x, X, e, E, f, g, G. Check the following web page: http://www.gkrueger.com/java/printf.html Alan G From alan.gauld@bt.com Mon Feb 28 10:59:04 2000 From: alan.gauld@bt.com (alan.gauld@bt.com) Date: Mon, 28 Feb 2000 10:59:04 -0000 Subject: [Tutor] (no subject) Message-ID: <5104D4DBC598D211B5FE0000F8FE7EB202DF6083@mbtlipnt02.btlabs.bt.co.uk> > > info it was supposed to be released in Sept. or Oct. 99. I bought > > "Learning Python" but being a Novice in Programming, (as > well as a Newbie > > in Linux) it seems to be way above my head. So I am > anxiously waiting for > > your book. Since this seems a good time for self promotion :-) ... I am currently turning my online tutor into a book. It will feature several new chapters and use VBScript and Javascript instead of Tcl and QBASIC as the comparative languages. I don't expect it out much before the end of the year but since I passed the half way mark on the first draft this weekend I now feel confident enough to announce its existence as a project. That will make at least 2 beginners books on Python. Alan G. http://www.crosswinds.net/~agauld/ From ivanlan@callware.com Mon Feb 28 12:55:49 2000 From: ivanlan@callware.com (Ivan Van Laningham) Date: Mon, 28 Feb 2000 05:55:49 -0700 Subject: [Tutor] (no subject) References: <5104D4DBC598D211B5FE0000F8FE7EB202DF6083@mbtlipnt02.btlabs.bt.co.uk> Message-ID: <38BA7055.BC2429AD@callware.com> Hi All-- alan.gauld@bt.com wrote: > > Since this seems a good time for self promotion :-) ... > BSP ("Blatant Self Promotion");-) > I am currently turning my online tutor into a book. It > will feature several new chapters and use VBScript and > Javascript instead of Tcl and QBASIC as the comparative > languages. > > I don't expect it out much before the end of the year > but since I passed the half way mark on the first draft > this weekend I now feel confident enough to announce > its existence as a project. That will make at least > 2 beginners books on Python. > That's wonderful news, Alan. Who's your publisher? Congratulations, Ivan ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. http://www.pauahtun.org and http://www.foretec.com/python/workshops/1998-11/proceedings.html Army Signal Corps: Cu Chi, Class of '70 Author: Teach Yourself Python in 24 Hours From ivanlan@callware.com Tue Feb 29 02:24:19 2000 From: ivanlan@callware.com (Ivan Van Laningham) Date: Mon, 28 Feb 2000 19:24:19 -0700 Subject: `Re: [Tutor] help!!! References: <20000229013011.5664.qmail@hotmail.com> Message-ID: <38BB2DD3.82E20EB0@callware.com> Hi All, Tiffany-- Tiffany Olson wrote: > > I have a Windows, and my entire system is Gateway > What you need to do is to install Python. Don't accept the default directory, but install to "c:\Python" instead. Install Tcl to "c:\Tcl". Answer "yes" to all the rest of the questions. Once you have done that, open a DOS prompt (found on your menu--hit the Windows key) and type "cd c:\Python" and hit return. After that, type "python" and hit return. You should get something that looks like this: C:\Python> python Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32 Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam >>> Once you see the ">>>", you know that Python is installed correctly. Type this: print "Hello, world!" and hit return. You should see this: >>> print "Hello, world!" Hello, world! >>> And you're on your way. Take a look at Alan's beginner tutorial at http://members.xoom.com/alan_gauld/tutor/tutindex.htm Work some of the exercises. When you're done, type a ^Z at the >>> prompt. That means press the Z and Ctrl keys simultaneously. Python will exit, and you'll return to the "C:\Python>" prompt. When replying to messages from the tutor list, don't forget to make sure that the address you're using is tutor@python.org If it's not, you're only replying to whomever posted that message, and others can't chime in to help you too. Good luck, Ivan ---------------------------------------------- Ivan Van Laningham Callware Technologies, Inc. http://www.pauahtun.org and http://www.foretec.com/python/workshops/1998-11/proceedings.html Army Signal Corps: Cu Chi, Class of '70 Author: Teach Yourself Python in 24 Hours From reddskull@hotmail.com Tue Feb 29 19:18:33 2000 From: reddskull@hotmail.com (skulleton User) Date: Tue, 29 Feb 2000 19:18:33 GMT Subject: [Tutor] (no subject) Message-ID: <20000229191833.57086.qmail@hotmail.com> where can i get a book on the basic information to study and learn how to use it. Redd ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com From spirou@carolo.net Tue Feb 29 20:34:01 2000 From: spirou@carolo.net (Denis) Date: Tue, 29 Feb 2000 20:34:01 +0000 Subject: [Tutor] Zope enabled web hosting (was: Need for pedestrian-level explanation) References: <008301bf8075$58d75820$42e60ecb@jstok> Message-ID: <38BC2D39.C2E019D0@carolo.net> Bill Bedford wrote: > Out of interest -- does anyone know of a Zope enabled web hosting > company in the UK? > Though I think your question is off topic on this list and I found your "Out of interest" at least unpleasant, I'm pleased to submit you this URL : http://www.zope.org/Resources/ZSP Denis Frčre From billbnor@mousa.demon.co.uk Tue Feb 29 22:09:53 2000 From: billbnor@mousa.demon.co.uk (Bill Bedford) Date: Tue, 29 Feb 2000 22:09:53 +0000 Subject: [Tutor] Re: Zope enabled web hosting (was: Need for pedestrian-level explanation) In-Reply-To: <38BC2D39.C2E019D0@carolo.net> References: <008301bf8075$58d75820$42e60ecb@jstok> <38BC2D39.C2E019D0@carolo.net> Message-ID: At 8:34 pm +0000 29/02/00, Denis wrote: >Bill Bedford wrote: > >> Out of interest -- does anyone know of a Zope enabled web hosting >> company in the UK? >> > Mmmm >Though I think your question is off topic on this list Probably >and I found your >"Out of interest" at least unpleasant, Why? Is seems to me a perfectly common colloquialism for flagging a casual enquiry. > I'm pleased to submit you this URL : > >http://www.zope.org/Resources/ZSP > So the answer is "No" Thanks for your time....... -- Bill Bedford mailto:billb@mousa.demon.co.uk Just because it's not nice doesn't mean it's not miraculous. From legacy@ihug.co.nz Tue Feb 29 22:11:16 2000 From: legacy@ihug.co.nz (Legacy) Date: Wed, 1 Mar 2000 11:11:16 +1300 Subject: [Tutor] learning a Programming language Message-ID: <001c01bf8301$ecb2a5c0$67effea9@daz> This is a multi-part message in MIME format. ------=_NextPart_000_0017_01BF836E.DD2824A0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I wish to learn programming under the Windows environment (Win 9x + = Win2000). I have minimal if no programming experience (except very basic BASIC = about 15 years ago). Should I start with Python or with Visual Basic. = What are the principal differences between the languages. Please try and give an unbiased view. Thanks. Darren ------=_NextPart_000_0017_01BF836E.DD2824A0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
 
I wish to learn programming under the Windows = environment (Win=20 9x + Win2000).
 
I have minimal if no programming experience (except = very basic=20 BASIC about 15 years ago).  Should I start with Python or with = Visual=20 Basic.  What are the principal differences between the=20 languages.
 
Please try and give an unbiased view.
 
Thanks.
 
Darren
------=_NextPart_000_0017_01BF836E.DD2824A0-- From deirdre@deirdre.net Tue Feb 29 11:31:06 2000 From: deirdre@deirdre.net (Deirdre Saoirse) Date: Tue, 29 Feb 2000 03:31:06 -0800 (PST) Subject: [Tutor] learning a Programming language In-Reply-To: <001c01bf8301$ecb2a5c0$67effea9@daz> Message-ID: On Wed, 1 Mar 2000, Legacy wrote: > I have minimal if no programming experience (except very basic BASIC > about 15 years ago). Should I start with Python or with Visual Basic. > What are the principal differences between the languages. Visual Basic only runs on Windows; Python runs on practically everything. Visual Basic is best suited for GUI applications; where I work we use Python for a lot of background processes that run on several platforms. In fact, we can move them from Linux <-> NT (some run on both platforms). If you want to limit yourself to ONLY writing for Windows, you may be better off using Visual Basic. -- _Deirdre * http://www.linuxcabal.org * http://www.deirdre.net I've _never_ made a decision I've been happier with than quitting $FIRM. -- Rick Moen From gerrit@nl.linux.org Tue Feb 29 22:28:41 2000 From: gerrit@nl.linux.org (Gerrit Holl) Date: Tue, 29 Feb 2000 23:28:41 +0100 Subject: [Tutor] learning a Programming language In-Reply-To: <001c01bf8301$ecb2a5c0$67effea9@daz>; from legacy@ihug.co.nz on Wed, Mar 01, 2000 at 11:11:16AM +1300 References: <001c01bf8301$ecb2a5c0$67effea9@daz> Message-ID: <20000229232840.A8644@nl.linux.org> > > I wish to learn programming under the Windows environment (Win 9x + Win2000). I wanted this too, about a year ago. I started with Python (first on Win 95 but after a few weeks on Linux ) and it's an extremely good first language. > > I have minimal if no programming experience (except very basic BASIC about 15 years ago). Should I start with Python or with Visual Basic. What are the principal differences between the languages. > > Please try and give an unbiased view. I'm afraid you can't get an unbiased view in here, because we're all biased towards Python (aren't we?). Try in the comp.programming newsgroup or be content with a biased view. just-learn-Python-ly y'rs - gerrit. -- -----BEGIN GEEK CODE BLOCK----- http://www.geekcode.com Version: 3.12 GCS dpu s-:-- a14 C++++>$ UL++ P--- L+++ E--- W++ N o? K? w--- !O !M !V PS+ PE? Y? PGP-- t- 5? X? R- tv- b+(++) DI D+ G++ !e !r !y -----END GEEK CODE BLOCK-----