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 subscription options: http:/

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. Python makes programmi

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() >

Re: [Tutor] Notepad++ question

2012-06-07 Thread Marc Tompkins
On Thu, Jun 7, 2012 at 12:41 AM, Alan Gauld wrote: > This is almost certainly down to mixing tabs and spaces. > You can mix them in a file but not within a block. (And > even then I would recommend sticking to just one style) > Some editors make it worse by autoindenting with a mixture > of tabs a

Re: [Tutor] Finding palindromes in a list

2012-06-08 Thread Marc Tompkins
On Fri, Jun 8, 2012 at 5:10 PM, Mike Nickey wrote: > def compareElements(wordList): >for item in wordList(): >if item == item.reversed(): >print item >else: >next(item) > > reversed() is not a string method. To reverse a string, try something like this

Re: [Tutor] get columns from txt file

2012-07-13 Thread Marc Tompkins
On Thu, Jul 12, 2012 at 11:36 PM, susana moreno colomer < susana...@hotmail.com> wrote: > Hi! > I am trying this, but still I get 6 numbers per cell. The only one > difference is that I get a comma between numbers instead an space. > I am opening the document also with excel > Many thanks, > Susa

Re: [Tutor] get columns from txt file

2012-07-13 Thread Marc Tompkins
Reply to the group, please! On Fri, Jul 13, 2012 at 2:09 AM, susana moreno colomer < susana...@hotmail.com> wrote: > > Hi! > I am sorry, but still I don't get it! > I am trying with this (the code is attached) > > csv_out=csv.writer(open('out1.csv', 'wb'), delimiter=' ', > quoting=csv.QUOTE_ALL,

Re: [Tutor] converting EBCIDIC to ASCII

2012-07-13 Thread Marc Tompkins
On Thu, Jul 5, 2012 at 9:30 AM, Prinn, Craig wrote: > ** ** ** ** ** ** > > I am trying to convert an EBCIDIC file to ASCII, when the records are > fixed length I can convert it fine, I have some files that are coming in as > variable length records, is there a way to convert the file in Python? I

Re: [Tutor] converting EBCIDIC to ASCII

2012-07-13 Thread Marc Tompkins
helps, and I don't know what you'd need to move forward. Good luck! > > ** ** > -- > > *From:* Marc Tompkins [mailto:marc.tompk...@gmail.com] > *Sent:* Friday, July 13, 2012 3:30 PM > *To:* Prinn, Craig > *Cc:* tutor@python.

Re: [Tutor] finally without try or except

2012-07-30 Thread Marc Tompkins
On Mon, Jul 30, 2012 at 9:56 AM, Tino Dai wrote: > Hi! > > Is there anyway to execute a block of code at the end of a program in > 2.6 regardless of what happened before eg exiting normally or died because > of an exception? > I was thinking about maybe a free standing finally code block or

Re: [Tutor] running more than one python program at the same time

2012-08-28 Thread Marc Tompkins
On Tue, Aug 28, 2012 at 3:30 PM, Benjamin Fishbein wrote: > Hello, > I wrote a program that I want to have running 24/7. But the problem is > that I also want to write and run other programs. I'm using Idle and it > won't let me run more than one script at a time. Do you know if there's a > way to

Re: [Tutor] running more than one python program at the same time

2012-08-29 Thread Marc Tompkins
On Tue, Aug 28, 2012 at 7:35 PM, Steven D'Aprano wrote: In Windows, that is the DOS prompt -- either cmd.com or command.exe, I > never remember which one is which. I'm pretty sure that was intentional, but just in case... In MS-DOS/PC-DOS, and in 16-bit versions of Windows (up to Windows 98/Me,

Re: [Tutor] How to send email from a gmail a/c using smtp when port 587(smtp) is blocked

2012-09-11 Thread Marc Tompkins
On Tue, Sep 11, 2012 at 2:44 PM, ashish makani wrote: > Folks, > > some more context so people presume we are spammers :) > > These emails are automated diagnostic emails sent to a group of a few > admins, so we get notified when a python heartbeat script, detects a > failure in things like n/w co

Re: [Tutor] How to send email from a gmail a/c using smtp when port 587(smtp) is blocked

2012-09-11 Thread Marc Tompkins
On Tue, Sep 11, 2012 at 3:27 PM, ashish makani wrote: > Marc, > your 3rd point, > >> you could establish a VPN tunnel to some server outside of the >> university's network and send from port 587 on THAT machine. Complicated, >> weird, and not horribly secure. But doable. > > Could you point me t

[Tutor] Fwd: "ImportError: _strptime not supported"

2012-10-02 Thread Marc Tompkins
Forgot to send to the list. Grrr. -- Forwarded message -- From: Marc Tompkins Date: Tue, Oct 2, 2012 at 3:32 PM Subject: Re: [Tutor] "ImportError: _strptime not supported" To: aklei...@sonic.net On Tue, Oct 2, 2012 at 3:19 PM, wrote: > > The following c

Re: [Tutor] bin to dec conversion puzzlement

2015-04-20 Thread Marc Tompkins
On Apr 20, 2015 6:56 AM, "Jim Mooney" wrote: > > I can't seem to get my head around this 'simple' book example of > binary-to-decimal conversion, which goes from left to right: > > B = '11011101' > I = 0 > while B: > I = I * 2 + int(B[0]) > B = B[1:] > > print(I) > >>> 221 > > My thought w

Re: [Tutor] Pun panic, was Re: calling a method directly

2015-04-21 Thread Marc Tompkins
On Tue, Apr 21, 2015 at 7:09 AM, Martin A. Brown wrote: > And, I dairy not chase this pun any further > No - keep milking it. It gets butter all the time. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https

Re: [Tutor] Is there a way to store and later use comparison operators (<, <=, =, >=, >) ?

2015-04-29 Thread Marc Tompkins
On Wed, Apr 29, 2015 at 1:10 PM, boB Stepp wrote: > Python 2.4.4, Solaris 10. > > I have some functions that I believe I could collapse into a single > function if I only knew how: > > def choose_compare(operator, value0, value1, pass_color, fail_color): > """ > Perform the comparison ind

Re: [Tutor] Pep 8, about indentation

2015-08-10 Thread Marc Tompkins
On Aug 10, 2015 12:17 PM, "David Rock" wrote: > Yeah, BS is more accurate (although BS says Delete on my keyboard). > Gotta love consistency :-) I'm guessing you use a Mac, then...? Whenever I have to use a Mac keyboard, the lack of a Delete/relabeling of the Backspace key drives me nuts. The e

Re: [Tutor] Dave Angel

2015-08-18 Thread Marc Tompkins
Thank you very much - and thanks to Dave for his contributions over the years. On Tue, Aug 18, 2015 at 1:49 AM, Alan Gauld wrote: > Many members of the list will remember Dave Angel as a regular and active > participant over many years. However, Dave has not been active on the list > for a littl

Re: [Tutor] pip install in a virtualenv *without* internet?

2015-08-19 Thread Marc Tompkins
On Wed, Aug 19, 2015 at 9:18 AM, Alex Kleider wrote: > I guess if you 'never' have an internet connection what I'm trying to do > won't work, > but I'm addressing a different use case: I have connectivity in some > environments > but would like to be able to do a pip install at times when there

Re: [Tutor] About using list in a function

2015-08-19 Thread Marc Tompkins
On Wed, Aug 19, 2015 at 10:25 AM, Alan Gauld wrote: > On 19/08/15 17:09, Michelle Meiduo Wu wrote: > >> Hi there, >> I'm trying to use List in a function. But it doesn't work. Here are >> sample code not work: ---def >> getResult():ls = []ls= ls.append(

Re: [Tutor] About using list in a function

2015-08-19 Thread Marc Tompkins
On Wed, Aug 19, 2015 at 11:36 AM, Emile van Sebille wrote: > On 8/19/2015 11:20 AM, Marc Tompkins wrote: > >> (Every couple of weeks, despite my repeated >> attempts to stop TBird from auto-updating, I find that they've got a new >> version and can't connect.

Re: [Tutor] Creating lists with definite (n) items without repetitions

2015-09-06 Thread Marc Tompkins
On Fri, Sep 4, 2015 at 7:28 AM, marcus lütolf wrote: > I should probably tell you the real task are a series (maximum ~ 301) > lists in which real names of people are assigned to the items/letters for > 2 people(golfers) can be in the same list(flight) only once for an > extended period of tim

Re: [Tutor] Newbie question: programs not printing

2016-03-10 Thread Marc Tompkins
On Thu, Mar 10, 2016 at 5:33 AM, Patrick Craine wrote: > >>> x = int(raw_input('Enter an integer: ')) > if x%2 == 0: > print 'Even' > else: > print 'Odd' > if x%3 != 0: > print 'And not divisible by 3' > Enter an integer: 3 > >>> > > It could be your email program that's messing with your indenta

Re: [Tutor] What is wrong with my Python program that causes it to run but not give results?

2016-10-25 Thread Marc Tompkins
On Oct 25, 2016 3:07 PM, "Ed Troy" wrote: >I get an error message: > edward@ubuntu:~$ python LED_model_utf8.py LED_IV.txt > Traceback (most recent call last): > File "LED_model_utf8.py", line 4, in > import matplotlib.pyplot as plt > ImportError: No module named matplotlib.pyplot > That la

Re: [Tutor] Problem with Spyder IDE in Anaconda3

2017-02-27 Thread Marc Tompkins
On Mon, Feb 27, 2017 at 10:46 AM, Stephen P. Molnar wrote: > I had sent the following message to Anaconda Support: > > I have just installed anaconda3-4.3.0 and upgraded Spyder to v-3.1.3. > > When I open Spyder and run a python script that has run perfectly in a > previous version of Spyder I g

Re: [Tutor] Problem with Spyder IDE in Anaconda3

2017-02-27 Thread Marc Tompkins
On Mon, Feb 27, 2017 at 12:52 PM, Stephen P. Molnar wrote: > On 02/27/2017 02:29 PM, Marc Tompkins wrote: > >> On Mon, Feb 27, 2017 at 10:46 AM, Stephen P. Molnar >> mailto:s.mol...@sbcglobal.net>> wrote: >> >> I had sent the following message to Ana

Re: [Tutor] HELP- Regarding working with python

2013-01-18 Thread Marc Tompkins
On Thu, Jan 17, 2013 at 10:11 PM, Gayathri S wrote: > >>> import numpy as np > >>> import matplotlib.pyplot as plt > >>> import mlpy > >>> np.random.seed(0) > >>> mean,cov,n=[0,0],[[1,1],[1,1.5]],100 > >>> x=np.random.multivariate_normal(mean,cov,n) > >>> pca.learn(x) > Traceback (most recent call

Re: [Tutor] automate add-to-cart with python

2013-01-29 Thread Marc Tompkins
On Tue, Jan 29, 2013 at 9:19 PM, Benjamin Fishbein wrote:Then it said: > > You can also use easy_install, or if you have no Python package manager > available at all, you can just grab the single file > virtualenv.py and > run it with py

Re: [Tutor] building a website with python

2013-04-09 Thread Marc Tompkins
On Tue, Apr 9, 2013 at 2:54 PM, Prasad, Ramit wrote: > Your hosting solution (needs) to support Python, and I do not believe all > hosts support Python. You > should double check with whatever host you choose. > Almost all commercial web hosts offer limited Python support (running as an Apache mo

Re: [Tutor] Sys.argv read parameters

2013-04-17 Thread Marc Tompkins
On Wed, Apr 17, 2013 at 1:03 PM, Danny Yoo wrote: > ## > ## double: string -> string > def double(x): > return x + x > > > ## For example, a blast from the past: > print "The Noid says: " + double("pizza") > ## > I'm sorry, but this is a bug.

Re: [Tutor] Runs in IDLE with F5, but not in Windows Command Prompt

2013-04-25 Thread Marc Tompkins
On Wed, Apr 24, 2013 at 9:36 PM, eryksun wrote: > .py files need to be associated with %windir%\py.exe. NO! %windir% means "the directory where Windows is installed", usually (but not always) C:\Windows. You're saying that there needs to be a py.exe in the Windows directory - this is absolute

Re: [Tutor] Runs in IDLE with F5, but not in Windows Command Prompt

2013-04-25 Thread Marc Tompkins
On Thu, Apr 25, 2013 at 12:51 AM, eryksun wrote: > On Thu, Apr 25, 2013 at 3:41 AM, Marc Tompkins > wrote: > > On Wed, Apr 24, 2013 at 9:36 PM, eryksun wrote: > >> > >> .py files need to be associated with %windir%\py.exe. > > > > > > NO! > &

Re: [Tutor] Runs in IDLE with F5, but not in Windows Command Prompt

2013-04-25 Thread Marc Tompkins
On Thu, Apr 25, 2013 at 5:40 AM, boB Stepp wrote: > One thing that no one has addressed so far is why when I put quotes > around my input, as in 'boB', the program does run in the command > prompt. > Remember that input(), in Python 2, executes what's passed to it. If your input is boB, then Py

<    1   2   3   4   5   >