Re: [Tutor] documentation tut.html Error 404

2008-10-17 Thread Marc Tompkins
> > http://www.python.org/doc/current/tut/tut.html >> > Reminds me of Christopher Robin helping Winnie-the-Pooh try to fool the bees: "Tut tut, looks like rain! Tut tut, looks like rain!" At least that's how Stanley Holloway said it on the Disney record I had as a child... -- www.fsrtechnologies

Re: [Tutor] automatically generate python/pylons documentation

2008-10-18 Thread Marc Tompkins
On Sat, Oct 18, 2008 at 6:45 AM, Arun Tomar <[EMAIL PROTECTED]> wrote: > > I've a pylons web application in the directory called helloworld. > if i give the command for epydoc to generate the documentation it > gives the below mentioned errors: > > epydoc helloworld/ > Error: Directory 'hellowor

Re: [Tutor] Creating a single .exe file without py2exe and pyinstaller

2008-10-19 Thread Marc Tompkins
On Sun, Oct 19, 2008 at 7:51 AM, Robert Berman <[EMAIL PROTECTED]>wrote: > If you want a real exe rewrite it in C or C++. Python is an interpretive > language; my apologies to those who say it is 'semi-compilable'. > Let me re-word that a little bit. When you write an application in Python, you

Re: [Tutor] Creating a single .exe file without py2exe and pyinstaller

2008-10-19 Thread Marc Tompkins
On Sun, Oct 19, 2008 at 9:26 AM, Chris Fuller <[EMAIL PROTECTED] > wrote: > > The freeze utillity, http://wiki.python.org/moin/Freeze, will do what you > want, on unixlikes, at least. It has its own set of caveats, of course. > You > need a C compiler, and preferably the same one that was used t

Re: [Tutor] Open Source database software

2008-11-25 Thread Marc Tompkins
On Mon, Nov 24, 2008 at 4:19 PM, Mike Meisner <[EMAIL PROTECTED]> wrote: > I'd like to get away from using Microsoft Access. I have a number of > Access databases to convert. > There's an open source package out there called "mdbtools", specifically for working with Access databases. The Python

Re: [Tutor] reading inputs from keyboard

2008-12-14 Thread Marc Tompkins
On Sun, Dec 14, 2008 at 10:48 AM, Robert Berman wrote: > > Rather than being impressed, perhaps you might consider performing the action. > > spir wrote: > > Robert Berman a écrit : > > RTFM. > > how clever! > I'm impressed... > Denis Also, you might have noticed that Denis wasn't the original po

Re: [Tutor] what does the "@" operator mean?

2008-12-15 Thread Marc Tompkins
On Mon, Dec 15, 2008 at 12:33 PM, Mary Lou Knack wrote: > I'm looking at some code from Enthought's ETS examples and ran across the > following statement: > > @mayavi2.standalone > > I have no idea what the "@" operator means, if anything. I tried searching > for it in the documentation (locally

Re: [Tutor] what does the "@" operator mean?

2008-12-15 Thread Marc Tompkins
On Mon, Dec 15, 2008 at 5:03 PM, Alan Gauld wrote: > > "Marc Tompkins" wrote > >> If you're just starting out in Python, decorators can be hard to get >> your head around... > > I've been using Python for oover 10 years and still find decorators

Re: [Tutor] what does the "@" operator mean?

2008-12-16 Thread Marc Tompkins
OK, having looked at http://wiki.python.org/moin/PythonDecoratorLibrary again with a less jaundiced eye, I believe my code may soon begin to contain a few of the dreaded sleepycats... By the way, (totally off-topic, of course, my apologies): what do all y'all call the "@" operator? Here in the St

Re: [Tutor] WAYNE'S WANING...

2009-01-06 Thread Marc Tompkins
Sorry - forgot to Reply All... On Tue, Jan 6, 2009 at 9:53 AM, WM. wrote: > One of the replies to my post explained how difficult it is to address an > audience composed of several levels of skill. I understand that, nor was I > condemning anyone who has a better command of jargon than I have. J

Re: [Tutor] casting string to integer in a list of lists

2009-01-08 Thread Marc Tompkins
On Thu, Jan 8, 2009 at 11:51 AM, culpritNr1 wrote: > > Hi All, > > Say I have this nice list of lists: > > LoL = [['chrX', '160944034', '160944035', 'gnfX.145.788', '63.60'], > ['chrX', '161109992', '161109993', 'rs13484104', '63.60'], > ['chrX', '161414112', '161414113',

Re: [Tutor] casting string to integer in a list of lists

2009-01-08 Thread Marc Tompkins
On Thu, Jan 8, 2009 at 2:21 PM, wesley chun wrote: > except: >pass > > try not to code these 2 lines in anything that you do because it will > come back to haunt you when something is not working right but you > can't find any errors. that's because this code masks and throws away > everythin

Re: [Tutor] casting string to integer in a list of lists

2009-01-08 Thread Marc Tompkins
On Thu, Jan 8, 2009 at 3:45 PM, wesley chun wrote: > A tuple of exceptions works, just like what we did above, and more, > i.e., (IndexError, ValueError, TypeError, KeyError... > > Thank you, thank you, thank you! I'm sure it's been staring me in the face, but I never realized I could use a tupl

Re: [Tutor] power of 2.718282

2009-01-13 Thread Marc Tompkins
On Tue, Jan 13, 2009 at 10:19 AM, culpritNr1 wrote: > > How do I compute a power of e in Python? > > Say I need 2.718282 to the 10th. In R for example, I just do exp(10). > > I would appreciate a low level solution because I have to iteratively call > that computation millions of times. Anything m

Re: [Tutor] power of 2.718282

2009-01-13 Thread Marc Tompkins
On Tue, Jan 13, 2009 at 1:39 PM, Alan Gauld wrote: > I would appreciate a low level solution because I have to iteratively call >> that computation millions of times. Anything more efficient than >> 2.718182**10 may be good. >> > > Umm, what's wrong with > > from math import e # more precision th

Re: [Tutor] help with getting python to run from command prompt on Windows XP

2009-01-14 Thread Marc Tompkins
On Wed, Jan 14, 2009 at 12:09 PM, wesley chun wrote: > > i fully agree with kent's comments/suggestions. you appeared to have > them do the right thing. fwiw, the only time i run into that error > after doing the same thing as you is that i'm trying that command in > an already-opened command win

Re: [Tutor] help with getting python to run from command prompt onWindows XP

2009-01-15 Thread Marc Tompkins
On Thu, Jan 15, 2009 at 9:35 AM, Dj Gilcrease wrote: > if he just needs to run python scripts you just need to type the > script name (preferably from the directory it is in) > > eg: C:\Path\To\App>app_name.py > > and it will run > By default, and on most people's machines, not true. You can do

Re: [Tutor] help with getting python to run from command prompt onWindows XP

2009-01-15 Thread Marc Tompkins
On Thu, Jan 15, 2009 at 8:48 AM, Brian van den Broek wrote: > > The (recognized by me as) relevant bits of output are: > Path=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program > Files\texlive\2008\bin\win32;C:\Python26 > PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH > >

Re: [Tutor] calculator will not multiply

2009-01-18 Thread Marc Tompkins
On Sun, Jan 18, 2009 at 7:37 AM, David wrote: > Everything else works + - / but not * > why? > thanks > -david > > > #!/usr/bin/python > from __future__ import division > import sys > > > def add(x, y): >return x + y > def sub(x, y): >return x - y > def dev(x, y): >return x / y > def

Re: [Tutor] Convert String to Int

2009-01-18 Thread Marc Tompkins
On Sun, Jan 18, 2009 at 5:15 PM, Ian Egland wrote: > I know that, should you want to get an int from the user, you use > int(input("Question!")). However, what if the user wasn't that savvy and > didn't realize he/she HAD to enter a number? Program crash. Is there a way > that I can get the input

Re: [Tutor] Finding the shortest word in a list of words

2009-01-19 Thread Marc Tompkins
2009/1/19 John Fouhy > 2009/1/20 Emad Nawfal (عماد نوفل) : > Of course, this is not necessarily the best answer for your particular > problem. The problem with sorting is that you have to look at some > elements more than once. For short lists, it's not a problem, but it > can slow you down on

Re: [Tutor] Finding the shortest word in a list of words

2009-01-20 Thread Marc Tompkins
On Tue, Jan 20, 2009 at 5:42 AM, Lie Ryan wrote: > > Using sys.maxint to prime minLen is overkill, of course - > > "antidisestablishmentarianism" is only 28 letters long, after all - but > > it should be larger than any word you can expect to see. This doesn't > > catch ties, though... could do t

Re: [Tutor] Finding the shortest word in a list of words

2009-01-20 Thread Marc Tompkins
On Tue, Jan 20, 2009 at 11:23 AM, Lie Ryan wrote: > what I meant as wrong is that it is possible that the code would be used > for a string that doesn't represent human language, but arbitrary array > of bytes. Also, it is a potential security issue. This is something I need to know, then - sys

Re: [Tutor] import confusion

2009-01-25 Thread Marc Tompkins
On Sun, Jan 25, 2009 at 8:23 PM, Eric Abrahamsen wrote: > Hi there, > > I'm trying to understand how module imports work, and am seeing some > behavior I don't understand: > > >>> import django > >>> from django import forms > >>> from forms import DecimalField > Traceback (most recent call last):

Re: [Tutor] import confusion

2009-01-25 Thread Marc Tompkins
On Sun, Jan 25, 2009 at 9:45 PM, Eric Abrahamsen wrote: > > Thanks for the break-down! I've got a fairly good handle on how to make all > this work correctly, I guess what I'm after is an understand of why the > above produces an error. What's going on in the system's module accounting > that makes

Re: [Tutor] struct question

2009-02-03 Thread Marc Tompkins
On Tue, Feb 3, 2009 at 10:29 AM, W W wrote: > > > On Tue, Feb 3, 2009 at 6:25 PM, bob gailer wrote: > >> >>> struct.calcsize('s') >> 1 >> >>> struct.calcsize('d') >> 8 >> >>> struct.calcsize('sd') >> 16 >> >> Why? Should not that be 9? >> > > >>> struct.calcsize('ds') > 9 > > at least on the cur

Re: [Tutor] struct question

2009-02-03 Thread Marc Tompkins
On Tue, Feb 3, 2009 at 11:05 AM, bob gailer wrote: > I have submitted this as a bug. Same behavior with c instead of s. > I don't think it's a bug. Each double requires 8 bytes; that 8 bytes needs to start at an 8-byte boundary. If your struct starts with a 1-byte object, then some empty paddi

Re: [Tutor] Picking up citations

2009-02-07 Thread Marc Tompkins
On Sat, Feb 7, 2009 at 1:19 PM, Kent Johnson wrote: > > It is correct except for the inclusion of "In" in the name and the > extra space before the comma separating the page numbers in the last > citation. > As I've been reading along, I've been thinking that the word "In" qualifies as a "magic

Re: [Tutor] Simple PassGen

2009-02-09 Thread Marc Tompkins
The print() function adds a newline. Try this instead - above your loop, create an empty string; in place of yor print(), append to the string; at the end, print the whole string. I'd demonstrate but I'm typing this from my phone. --- www.fsrtechnologies.com On Feb 9, 2009 1:35 PM, "Kayvan Sar

Re: [Tutor] Simple PassGen

2009-02-09 Thread Marc Tompkins
27; However, adding a trailing comma will eliminate that. It will still add a trailing space however. A better option would be like Marc suggests, although you have to do concatenation: mystr += random.choice(pool) You do have some other options though. Create a list and join it with '': In [

Re: [Tutor] Picking up citations

2009-02-09 Thread Marc Tompkins
Aha! My list of "magic words"! (Sorry for the top post - anybody know how to change quoting defaults in Android Gmail?) --- www.fsrtechnologies.com On Feb 9, 2009 2:16 PM, "Dinesh B Vadhia" wrote: Kent /Emmanuel I found a list of words before the first word that can be removed which I think i

Re: [Tutor] Choice of Python

2010-12-28 Thread Marc Tompkins
I love, love, love me some Python - it fits the way I think better than any other language I've used - but there is one consideration that occurs to me: Python is nearly ubiquitous on Linux/Mac, and easy to download and install on Windows - but most bargain-basement Web hosts don't support it (I'm

Re: [Tutor] Choice of Python

2010-12-28 Thread Marc Tompkins
On Tue, Dec 28, 2010 at 9:46 AM, Marc Tompkins wrote: > I love, love, love me some Python - it fits the way I think better than any > other language I've used - but there is one consideration that occurs to me: > Python is nearly ubiquitous on Linux/Mac, and easy to download an

Re: [Tutor] Choice of Python

2010-12-28 Thread Marc Tompkins
On Tue, Dec 28, 2010 at 9:56 AM, Emile van Sebille wrote: > On 12/28/2010 9:46 AM Marc Tompkins said... > > I love, love, love me some Python - it fits the way I think better than >> any >> other language I've used - but there is one consideration that occurs to

Re: [Tutor] Choice of Python

2010-12-28 Thread Marc Tompkins
On Tue, Dec 28, 2010 at 10:32 AM, wrote: > > Most of the hosting companies I've investigated support older versions of > Python and only support CGI access. > > Ah yes - that's what it was. To use Django (or most other frameworks) you need some processes to be running more or less constantly, as

Re: [Tutor] class question

2011-01-25 Thread Marc Tompkins
On Tue, Jan 25, 2011 at 3:26 PM, Elwin Estle wrote: > > Is it better to have one large sort of "do it all" class, or break the larger > class up into smaller classes?  Seems to me like the one large class would be > clearer in some ways.  I have something I am trying to do that have somewhere >

Re: [Tutor] sorted question

2011-01-25 Thread Marc Tompkins
On Tue, Jan 25, 2011 at 11:46 AM, It't me wrote: > Hi all, > > I'm learning Python with Google's Python class > > Ik have a question about the following code: > = > def sort(var): >  return var[-1]  #returns the last character of var > > def sort_last(): >   tup = [

Re: [Tutor] Changing Python icon - 2.6 and 3.2

2011-02-03 Thread Marc Tompkins
On Thu, Feb 3, 2011 at 9:18 AM, Patty wrote: > Hello Folks - I have Python 2.6.6 on my Windows 7 system and installed > Python 3.2. Now I want to be able to differentiate between the versions and > the icon for each version of Python is the same. I figured I would change > the the four applica

Re: [Tutor] calculate the sum of a variable - python

2011-03-06 Thread Marc Tompkins
On Sun, Mar 6, 2011 at 8:46 PM, nookasree ponamala wrote: > Thanks for the reply Wayne, but still it is not working, > > when I used int It throws the below error: > File "", line 2, in > File "", line 3, in summary > File "", line 3, in > ValueError: invalid literal for int() with base 10

Re: [Tutor] calculate the sum of a variable - python

2011-03-06 Thread Marc Tompkins
On Sun, Mar 6, 2011 at 11:27 PM, nookasree ponamala wrote: > Thanks a lot Marc. This works now. > > Sree. > > Glad to hear it. Welcome to the list, by the way. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscriptio

Re: [Tutor] Reading in data files

2011-03-14 Thread Marc Tompkins
On Mon, Mar 14, 2011 at 12:08 PM, paige crawford wrote: > Hey, > > > How do I read in a data file that has comments then remove the comments to > get to the numbers? The numbers in the data file needs to be read into a > list. There are also comments next to the numbers. The file looks something >

Re: [Tutor] multiple if and or statement

2011-03-14 Thread Marc Tompkins
On Mon, Mar 14, 2011 at 12:41 PM, Mike Franon wrote: > HI, > > I had a question, when running this small snippet of test code: > > > > a = ['test1', 'flag', 'monday'] > > for i in a: >if i == 'test1' or 'test2': > print 'true' > > > It always prints true > > > $ ./testing.py > true > tr

Re: [Tutor] Reading in data files

2011-03-14 Thread Marc Tompkins
On Mon, Mar 14, 2011 at 1:02 PM, Marc Tompkins wrote: > On Mon, Mar 14, 2011 at 12:59 PM, paige crawford < > plcrawf...@crimson.ua.edu> wrote: > >> How do I split them by spaces? >> >> Google "Python split". > > That might have been a bit abrupt...

Re: [Tutor] Saving information for my program

2011-03-21 Thread Marc Tompkins
On Mon, Mar 21, 2011 at 8:11 AM, michael scott wrote: > How do I save user created information in python? > As others have mentioned, SQL support is bundled with Python. If your collection of people and their attributes is expected to grow much, that would definitely be how I'd go. However, the

Re: [Tutor] help with user input

2011-03-21 Thread Marc Tompkins
On Mon, Mar 21, 2011 at 1:12 PM, Donald Bedsole wrote: > > This works fine as long as the user enters a number. However, if they > enter anything else, they just get the first :else statement, "You > were too greedy." > > I think that's because you're trying to do a string comparison, rather tha

Re: [Tutor] a function I fail to understand

2011-03-21 Thread Marc Tompkins
On Mon, Mar 21, 2011 at 6:06 PM, David wrote: > Hello list, > > I am having trouble understanding the following function. What trips me > up is the "letter = letter.lower()" line. > > As I understand, the function takes a letter and assigns True to a > letter if it is upper case. > > But then he

Re: [Tutor] working with strings in python3

2011-04-18 Thread Marc Tompkins
On Mon, Apr 18, 2011 at 5:17 PM, Rance Hall wrote: > Ok so I know what I am doing is deprecated (or at least poor form) but > the replacement must be awkward cause I'm not getting it. > > > so this is in a cli based program designed to print status messages to > the terminal on a linux box. > > p

Re: [Tutor] working with strings in python3

2011-04-18 Thread Marc Tompkins
On Mon, Apr 18, 2011 at 6:53 PM, Rance Hall wrote: > I'm going to go ahead and use this format even though it is deprecated > and then later when we upgrade it I can fix it. > > And there you have your answer. A list might make sense, but printing a message one word at a time > doesn't seem to

Re: [Tutor] Distutils Font Error

2011-04-18 Thread Marc Tompkins
On Mon, Apr 18, 2011 at 9:57 PM, Greg Nielsen wrote: > Dear Fellow Python Users, > > I am currently working on a small Python 3.1.3 game on a Windows 7 > machine and am attempting to freezing it using Distutils and cx_freeze so I > can share it with friends and family. Several attempts in I r

[Tutor] Fwd: working with strings in python3

2011-04-19 Thread Marc Tompkins
Forgot to send to group. Grrr. -- Forwarded message -- From: Marc Tompkins Date: Tue, Apr 19, 2011 at 10:01 AM Subject: Re: [Tutor] working with strings in python3 To: Rance Hall On Tue, Apr 19, 2011 at 6:44 AM, Rance Hall wrote: > > Bottom line: Python is not BASI

Re: [Tutor] Variables and constants [was Re: working with strings inpython3]

2011-04-19 Thread Marc Tompkins
On Tue, Apr 19, 2011 at 2:37 PM, Joel Goldstick wrote: > > On Tue, Apr 19, 2011 at 3:32 PM, wrote: > >> And presumably cleans up the leftover object with the value of 42 when it >> changes to point at the 43 object? >> >> Or does it leave all changes in memory until the program exits? >> > > If a

Re: [Tutor] Jokes on Python Language

2011-04-21 Thread Marc Tompkins
On Thu, Apr 21, 2011 at 4:49 AM, Ratna Banjara wrote: > Hello all, > > Does anybody knows jokes related to Python Language? > If the answer is yes, please do share it... > > It's not exactly a joke, but what you'll see if you accidentally go to python.com instead of python.org is... funny. __

Re: [Tutor] Jokes on Python Language

2011-04-21 Thread Marc Tompkins
On Thu, Apr 21, 2011 at 4:49 AM, Ratna Banjara wrote: > Hello all, > > Does anybody knows jokes related to Python Language? > If the answer is yes, please do share it... > Of course, there's the AWESOME webcomic xkcd (www.xkcd.com) which is excellent reading even when he's not talking about Pyth

Re: [Tutor] Unpack requires a string argument of length 8

2011-05-02 Thread Marc Tompkins
On Mon, May 2, 2011 at 12:36 PM, Susana Iraiis Delgado Rodriguez < susana.delgad...@utzmg.edu.mx> wrote: > I'm working on getting information that comes from a dbf file (database), > this dbf file is related to another file in the system, a shapefile. My code > is trying to get all the dbf name re

Re: [Tutor] can I walk or glob a website?

2011-05-18 Thread Marc Tompkins
On Wed, May 18, 2011 at 2:06 AM, Albert-Jan Roskam wrote: > Hello, > > How can I walk (as in os.walk) or glob a website? I want to download all > the pdfs from a website (using urllib.urlretrieve), extract certain figures > (using pypdf- is this flexible enough?) and make some statistics/graphs f

Re: [Tutor] can I walk or glob a website?

2011-05-18 Thread Marc Tompkins
On Wed, May 18, 2011 at 11:04 AM, Prasad, Ramit wrote: > > It's horribly crude, in retrospect, and I'm embarrassed re-reading my > code - but if you're interested I can forward it (if only as an example of > what _not_to do.) > > I would be interested even if the OP is not ;) > > OK then, but bea

Re: [Tutor] can I walk or glob a website?

2011-05-18 Thread Marc Tompkins
On Wed, May 18, 2011 at 11:21 AM, Marc Tompkins wrote: > On Wed, May 18, 2011 at 11:04 AM, Prasad, Ramit > wrote: > >> > It's horribly crude, in retrospect, and I'm embarrassed re-reading my >> code - but if you're interested I can forward it (if o

Re: [Tutor] can I walk or glob a website?

2011-05-19 Thread Marc Tompkins
On Thu, May 19, 2011 at 12:25 AM, Albert-Jan Roskam wrote: > Thank you, always useful to study other people's code. I wasn't planning to > create a Gui for my app. > It was necessary for the purpose - I didn't want all, or even most, of the mp3s on the site, but certainly enough of them that aut

Re: [Tutor] Python Interview Questions..

2011-05-26 Thread Marc Tompkins
On Thu, May 26, 2011 at 4:37 PM, Alan Gauld wrote: > > "Prasad, Ramit" wrote > > Is C still the standard interviewing basis for the computer science basics >> (e.g. data structures, algorithms, etc)? >> > > In the UK at least it is almost universally Java nowadays. > > C (and C++) are still yuse

Re: [Tutor] Python Interview Questions..

2011-05-26 Thread Marc Tompkins
On Thu, May 26, 2011 at 5:22 PM, Alan Gauld wrote: > > Indeed, I personally dislike Java, I think it encourages some very bad > programming design habits, especially in the OOP area, but sadly it is the > de facto standard... (And increasingly, so are the bad habits! :-( ) I despise it root an

Re: [Tutor] Python Interview Questions..

2011-05-27 Thread Marc Tompkins
On Fri, May 27, 2011 at 1:59 AM, Alan Gauld wrote: > > I want them to have studied the subject deeply and have a wealth of > experience. Studying computing because its an easy option is not an option > because its never easy. That was the point that Joel and I were making. The CS programs that

Re: [Tutor] Python Interview Questions..

2011-05-27 Thread Marc Tompkins
On Fri, May 27, 2011 at 8:38 PM, Steven D'Aprano wrote: > Not such a good analogy, since modern consumer goods are getting to the > point where they are almost unrepairable except by replacing the control > board. It often costs you *more* to fix a broken widget than to throw the > machine away an

Re: [Tutor] Class methods

2011-06-26 Thread Marc Tompkins
On Sun, Jun 26, 2011 at 7:12 PM, David Merrick wrote: > Is it possible too have > > crit1 = Critter("Dave") > crit2 = Critter("Sweetie") > farm = [crit1,crit2] #List# > > and then be able to use Critters methods on farm? > > No. farm is a list, and lists don't inherit the methods of the objects

Re: [Tutor] (no subject)

2011-07-02 Thread Marc Tompkins
On Fri, Jul 1, 2011 at 7:11 PM, David Merrick wrote: > NameError: global name 'stash' is not defined > > There are a _lot_ of missing pieces here; I think you started writing code without a plan of how your game would actually run. The current error is only the first you're going to run into her

Re: [Tutor] Blackjack Betting

2011-07-02 Thread Marc Tompkins
On Sat, Jul 2, 2011 at 4:47 PM, David Merrick wrote: > Each player needs to be able to bet > Traceback (most recent call last): > File "I:/Python/Python Source Code/chapter09/blackjackBetting.py", line > 204, in > main() > File "I:/Python/Python Source Code/chapter09/blackjackBetting.py

Re: [Tutor] broken script

2011-07-05 Thread Marc Tompkins
On Tue, Jul 5, 2011 at 3:23 PM, Martin A. Brown wrote: > I have heard people express frustration many times about how a > program(ming language) or "the computer" did not understand > something because the thing was 'missing a damned semicolon'. > > Unfortunately, these syntactical rules are quit

Re: [Tutor] broken script - curiouser and curiouser

2011-07-07 Thread Marc Tompkins
On Thu, Jul 7, 2011 at 3:15 AM, Lisi wrote: > There must have been > something, but I cannot fathom what. What difference does inserting a space > and then deleting it make? > I wonder whether you might have had a stray non-printing character in there? I believe that that would explain the

Re: [Tutor] Python conundrum

2011-07-07 Thread Marc Tompkins
On Thu, Jul 7, 2011 at 7:30 AM, Noah Hall wrote: > On Thu, Jul 7, 2011 at 3:17 PM, Lisi wrote: > > Hi! :-) > > > > >From the book I am working from: > > > > A shortcut is to do your import like this: > > from ex25 import * > > > > Is this a new and wonderful meaning of the word "shortcut"? >

Re: [Tutor] Homework problem

2011-07-20 Thread Marc Tompkins
On Wed, Jul 20, 2011 at 2:54 PM, Ken Baclig wrote: > Hi, > > I'm trying to make a function that receives text (a string) as an argument > and returns the same text (as string), but with 1 added to each word that is > a number. > > I need help getting started. > > So far, I have: > > def FindNumbe

Re: [Tutor] a quick Q: what does the "collapse" mean?

2011-09-08 Thread Marc Tompkins
On Thu, Sep 8, 2011 at 8:08 AM, lina wrote: > On Thu, Sep 8, 2011 at 11:03 PM, Steven D'Aprano > wrote: > > lina wrote: > > > >> collapse the text means? destory the text? make it collapse? > > > > Collapse runs of spaces into a single space. > > That's what I want, thanks. ^_^ > Be aware that

Re: [Tutor] need advice about a dictionary ({})

2011-09-10 Thread Marc Tompkins
On Sat, Sep 10, 2011 at 4:18 PM, Richard D. Moores wrote: > On Sat, Sep 10, 2011 at 15:32, Alan Gauld > wrote: > > So you open the file and from that point on treat it exactly like a > > dictionary. > > I'm still a bit shaky about dictionaries. > > That right there is the salient bit. Using shel

Re: [Tutor] Unusual pathfile

2011-09-13 Thread Marc Tompkins
On Tue, Sep 13, 2011 at 10:12 AM, Susana Iraiis Delgado Rodriguez < susana.delgad...@utzmg.edu.mx> wrote: > I think I've received many complains for my questions and messages, I know > you're great programmers and this is for helping beginners or any level of > Python users. I tried to correct the

Re: [Tutor] a quick Q: how to use for loop to read a series of files with .doc end

2011-10-04 Thread Marc Tompkins
On Tue, Oct 4, 2011 at 8:48 AM, lina wrote: > if os.path.isfile(fileName) and os.path.splitext(fileName)[1]==".xpm": > filedata = open(fileName) > text=filedata.readlines() > for line in text[0:]: > result.append({t:line.strip().count(t) for t in tokens}) >

Re: [Tutor] Finding if a passed variable is within to set parameters

2011-10-10 Thread Marc Tompkins
On Mon, Oct 10, 2011 at 3:13 PM, Mike Nickey wrote: > Hey all, > > I'm trying to write a def that has a check to see if the entered > information is within a pre-determined valid set. > Below is what I have so far but it doesn't seem to be working properly. > What I want is to have the user be ab

Re: [Tutor] regex and parsing through a semi-csv file

2011-10-19 Thread Marc Tompkins
On Wed, Oct 5, 2011 at 11:12 AM, Mina Nozar wrote: > Now, I would like to parse through this code and fill out 3 lists: 1) > activity_time, 2) activity, 3) error, and plot the activities as a function > of time using matplotlip. My question specifically is on how to parse > through the lines con

Re: [Tutor] regex and parsing through a semi-csv file

2011-10-19 Thread Marc Tompkins
On Wed, Oct 19, 2011 at 12:06 PM, Marc Tompkins wrote: > This approach also works in the event that the data wasn't all collected in > order - i.e. there might be data for Ag111 followed by U235 followed by > Ag111 again. > > Ahem... Of course, I meant "Ag47 followed

Re: [Tutor] Simple Question On A Method (in subclass)

2011-10-23 Thread Marc Tompkins
On Sun, Oct 23, 2011 at 8:08 PM, Chris Kavanagh wrote: > So we have {member.tell} as the last line of code. So trying to understand > this piece of code, {member} the variable is considered an object? Therefore > we can combine it with a function {tell()} using dot notation?? Is this > correct???

Re: [Tutor] Simple Question On A Method (in subclass)

2011-10-24 Thread Marc Tompkins
On Mon, Oct 24, 2011 at 9:20 PM, Chris Kavanagh wrote: > Makes perfect sense now. . .Thanks again Marc (and Alan, Dave) > BTW, do you guys luv Python the way I do!?? I just luv the way everything > works together so explicitly. I LUV learning this stuff!! > Oh yeah, baby.

Re: [Tutor] Simple Question On A Method (in subclass)

2011-10-24 Thread Marc Tompkins
On Mon, Oct 24, 2011 at 3:44 PM, bob gailer wrote: > On 10/24/2011 7:45 AM, Wayne Werner wrote: > > On Sun, Oct 23, 2011 at 11:06 PM, Marc Tompkins > wrote: > >> Things to remember: >> -you can get a value from a method, but you can't assign to it: >>

Re: [Tutor] Simple Question On A Method (in subclass)

2011-10-25 Thread Marc Tompkins
On Tue, Oct 25, 2011 at 5:31 AM, Chris Kavanagh wrote: > > > On 10/25/2011 3:50 AM, Dave Angel wrote: > >> On 10/25/2011 12:20 AM, Chris Kavanagh wrote: >> >>> >>> >>> On 10/24/2011 12:06 AM, Marc Tompkins wrote: >>> >>>&

Re: [Tutor] Paper Rock Scissors game - User's choice not returned properly

2011-10-31 Thread Marc Tompkins
On Mon, Oct 31, 2011 at 10:57 AM, Joel Montes de Oca wrote: > >  I came up with this to solve the problem. > > def UserChoice ():    # The function that returns the choice from the user >     while 1: > >         print 'Please select (P) for paper, (R) for Rock, or (S) for > Scissors.' >        

Re: [Tutor] Handling a Unicode Return using Pyodbc

2011-11-14 Thread Marc Tompkins
On Mon, Nov 14, 2011 at 1:43 PM, Tony Pelletier wrote: > Good Afternoon, > > I'm writing a program that is essentially connecting to MS SQL Server and > dumping all the contents of the tables to separate csv's. I'm almost > complete, but now I'm running into a Unicode issue and I'm not sure how t

Re: [Tutor] Trouble installing Python on Win7 (not a valid Win 32 app)

2011-11-14 Thread Marc Tompkins
On Mon, Nov 14, 2011 at 2:08 PM, Wayne Watson wrote: > I had py 2.5.2 installed (Yes, I know it's old) on my Win 7 64-bit PC > earlier this year, but it began to fail back in June. I tried a > uninstall/install, but that got me nowhere. I tried again yesterday. > Uninstalled, then puzzled over w

Re: [Tutor] Trouble installing Python on Win7 (not a valid Win 32 app)

2011-11-14 Thread Marc Tompkins
On Mon, Nov 14, 2011 at 4:00 PM, Wayne Watson wrote: > I do not see Python listed there. I see Word Pad, Winamp, Paint, ... > > I'm at CP/All CP Items/Default prgrms/Set Defaults > > My bad. It's Control Panel\Programs\Default Programs\Set Associations. (I could be wrong, but wasn't this all in

Re: [Tutor] Trouble installing Python on Win7 (not a valid Win 32 app)

2011-11-14 Thread Marc Tompkins
On Mon, Nov 14, 2011 at 4:55 PM, Wayne Watson wrote: > > > On 11/14/2011 4:04 PM, Marc Tompkins wrote: > > On Mon, Nov 14, 2011 at 4:00 PM, Wayne Watson < > sierra_mtnv...@sbcglobal.net> wrote: > >> I do not see Python listed there. I see Word Pad, Winamp, Paint,

Re: [Tutor] Trouble installing Python on Win7 (not a valid Win 32 app)

2011-11-15 Thread Marc Tompkins
On Mon, Nov 14, 2011 at 7:09 PM, Wayne Watson wrote: > > On 11/14/2011 6:17 PM, Marc Tompkins wrote: > > On Mon, Nov 14, 2011 at 4:55 PM, Wayne Watson < > sierra_mtnv...@sbcglobal.net> wrote: > >> >> On 11/14/2011 4:04 PM, Marc Tompkins wrote: >> >&g

Re: [Tutor] Trouble installing Python on Win7 (not a valid Win 32 app)

2011-11-15 Thread Marc Tompkins
On Tue, Nov 15, 2011 at 12:19 PM, Wayne Watson wrote: > > For py, I found \Python25\Lib\idlelib\idle.**pyw. >>> >>> Does no good to specify yet another .py file as the executable. You >> must specify a .EXE file (or .BAT, or .CMD, or very rarely, a .COM file). >> > In py land I only have py, p

Re: [Tutor] Trouble installing Python on Win7 (not a valid Win 32 app)

2011-11-15 Thread Marc Tompkins
On Tue, Nov 15, 2011 at 3:55 PM, Wayne Watson wrote: > ... > > With fingers crossed ... > >> >> I'm going to try one last time before I give up: >> >> - Go to Control Panel\Programs\Default Programs\Set Associations. DONE >> - Highlight the line for ".py" DONE >> - Click "Change program..." DONE

Re: [Tutor] question about pywin32

2011-12-26 Thread Marc Tompkins
On Mon, Dec 26, 2011 at 5:18 AM, daedae11 wrote: > ** > Does pywin32 provide a module for AES encryption algorithm ? > > The description of some module in pywin32 document is so simple that there > is not introduction about the function of the function. > For example, "CryptProtectData" function

Re: [Tutor] read in text file containing non-English characters

2012-01-12 Thread Marc Tompkins
On Thu, Jan 12, 2012 at 1:20 PM, Francis P. Boscoe wrote: > Given a simple text file of departments, capitals, longitude and latitude > separated by commas > > Ahuachapán,Ahuachapán,-89.8450,13.9190 > Cabañas,Sensuntepeque,-88.6300,13.8800 > Cuscatlán,Cojutepeque,-88.9333,13.7167 > > I would like

Re: [Tutor] OverflowError in lucky numbers script

2012-01-23 Thread Marc Tompkins
On Mon, Jan 23, 2012 at 10:51 AM, Shreesh bhat wrote: > I have given the definition of lucky numbers and constraints involved at > the starting of the thread. > when a number's sum of digits and square of sum of digits is prime,it is > called lucky. > Just to clarify: do you mean "(sum of digits)

Re: [Tutor] OverflowError in lucky numbers script

2012-01-23 Thread Marc Tompkins
On Mon, Jan 23, 2012 at 11:42 AM, Marc Tompkins wrote: > On Mon, Jan 23, 2012 at 10:51 AM, Shreesh bhat wrote: > >> I have given the definition of lucky numbers and constraints involved at >> the starting of the thread. >> when a number's sum of digits and square of

Re: [Tutor] OverflowError in lucky numbers script

2012-01-23 Thread Marc Tompkins
On Mon, Jan 23, 2012 at 12:08 PM, Shreesh bhat wrote: > No,i meant sum of digits is prime and also sum of square of digits is > prime. > E.g: 23 is lucky cos > 2+3=>5 (prime) > 2**2+3**2 => 4+9 => 13 (prime) > Thanks for the clarification - or I should say "correction", since "sum of square of di

Re: [Tutor] OverflowError in lucky numbers script

2012-01-23 Thread Marc Tompkins
On Mon, Jan 23, 2012 at 8:03 PM, Dave Angel wrote: > On 01/23/2012 10:31 PM, Marc Tompkins wrote: > >> On Mon, Jan 23, 2012 at 12:08 PM, Shreesh bhat** >> wrote: >> >> No,i meant sum of digits is prime and also sum of square of digits is >>> prime. >

Re: [Tutor] how to read and write to a file

2012-01-25 Thread Marc Tompkins
On Wed, Jan 25, 2012 at 3:30 PM, Steven D'Aprano wrote: > Steven D'Aprano wrote: > > (And yes, I deliberately had one fewer answer than question in the second >> case. Top posting makes it MUCH easier to miss questions.) >> > > Gah! Brain fart! Please ignore the comment in parentheses. > And I t

Re: [Tutor] compile time calculator

2012-01-27 Thread Marc Tompkins
On Fri, Jan 27, 2012 at 7:46 AM, Surya K wrote: > Hi, > > I want to calculate compile time for my puzzles. > Since nobody else has mentioned it yet... http://xkcd.com/303/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription o

Re: [Tutor] bogus characters in a windows file

2012-02-08 Thread Marc Tompkins
On Wed, Feb 8, 2012 at 5:46 PM, Garry Willgoose < garry.willgo...@newcastle.edu.au> wrote: > I'm reading a file output by the system utility WMIC in windows (so I can > track CPU usage by process ID) and the text file WMIC outputs seems to have > extra characters in I've not seen before. > > I use

Re: [Tutor] bogus characters in a windows file

2012-02-08 Thread Marc Tompkins
On Wed, Feb 8, 2012 at 6:09 PM, Marc Tompkins wrote: > On Wed, Feb 8, 2012 at 5:46 PM, Garry Willgoose < > garry.willgo...@newcastle.edu.au> wrote: > >> I'm reading a file output by the system utility WMIC in windows (so I can >> track CPU usage by process ID) and

[Tutor] The dreaded UnicodeDecodeError... why, why, why does it still want ascii?

2012-06-05 Thread Marc Tompkins
Hello all - it's been a while! I'm trying to parse a webpage using lxml; every time I try, I'm rewarded with "UnicodeDecodeError: 'ascii' codec can't decode byte 0x?? in position?: ordinal not in range(128)"  (the byte value and the position occasionally change; the error never does.) The pag

Re: [Tutor] The dreaded UnicodeDecodeError... why, why, why does it still want ascii?

2012-06-06 Thread Marc Tompkins
On Tue, Jun 5, 2012 at 11:22 PM, Stefan Behnel wrote: > You can do this: > >connection = urllib2.urlopen(url) >tree = etree.parse(connection, my_html_parser) > > Alternatively, use fromstring() to parse from strings: > >page = urllib2.urlopen(url) >pagecontents = page.read() >

<    1   2   3   4   5   >