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-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-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] 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] 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-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 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] 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] 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] 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] 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

[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] 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

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] 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] 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] 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] 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] 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] 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 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] 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] 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] 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] 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] 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] 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] 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 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
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] IDEs

2010-11-22 Thread Marc Tompkins
On Mon, Nov 22, 2010 at 1:13 AM, Josep M. Fontana wrote: > Alan gave me this piece of advice in his response to another message I > sent to the list. Since the topic is a bit different from the one in > the original message, I think it is better to start a different > thread. > > > Don;t run your

Re: [Tutor] Issues In Terminal

2010-09-26 Thread Marc Tompkins
On Sun, Sep 26, 2010 at 3:24 PM, Bill DeBroglie wrote: > > Is this what you mean? > > matthew-parrillas-macbook:Dawson_Book matthewparrilla$ #!/usr/bin/env > python > matthew-parrillas-macbook:Dawson_Book matthewparrilla$ ./chapter_2.py > ./chapter_2.py: line 1: syntax error near unexpected token

Re: [Tutor] Issues In Terminal

2010-09-26 Thread Marc Tompkins
On Sun, Sep 26, 2010 at 3:04 PM, David Hutto wrote: > > Pretty sure it's the parentheses, but I'm not an expert. In python 3 you > use > > print(), in 2.6 you either use import from __futur__ or print "string > here". > > I mean __future__ . > The parentheses are optional in 2.6, mandatory in 3.

Re: [Tutor] Issues In Terminal

2010-09-26 Thread Marc Tompkins
On Sun, Sep 26, 2010 at 2:55 PM, Bill DeBroglie wrote: > Which is great, but when I try and run the same code in the Terminal by > calling a program I've written (print("hello world") again) I get the > following: > >matthews-macbook:Dawson_Book matthewparrilla$ ./chapter_2.py >./c

Re: [Tutor] a logic problem in an if statement

2010-09-26 Thread Marc Tompkins
On Sun, Sep 26, 2010 at 1:36 PM, Bill Allen wrote: > I hate it when I do something like that!A combination of poor choice of > names for the variables and programming tunnel vision > Been there, done that! -- www.fsrtechnologies.com ___ Tutor

Re: [Tutor] a logic problem in an if statement

2010-09-26 Thread Marc Tompkins
On Sun, Sep 26, 2010 at 1:01 PM, Bill Allen wrote: > > Any thoughts how I am going wrong here? > > Looks like you've got two different names for the first mouse click... mouse_pos1 = mouse_pos > but > if mouse_pos[1] < height/2 and mouse_pos2[1] > height/2: > -- www.fsrtechnologies.

Re: [Tutor] Newbie - regex question

2010-08-30 Thread Marc Tompkins
On Mon, Aug 30, 2010 at 2:56 PM, Hugo Arts wrote: > To solve, we have the non-greedy patterns. They eat not as much > possible, but as little as possible. To make a qualifier non-greedy, > simply add an asterix at its end: > > r'WORD1-.*?' > > I would also like to offer one small correction: an a

Re: [Tutor] Databases in Python

2010-08-24 Thread Marc Tompkins
On Tue, Aug 24, 2010 at 12:44 PM, aug dawg wrote: > if searcher in database: >> # Figure this out. >> >> You need some sort of actual Python statement there as a placeholder - even just "print()". -- www.fsrtechnologies.com ___ Tutor maillist - Tut

Re: [Tutor] Difficulty Understanding Example Code for Blender Script

2010-07-21 Thread Marc Tompkins
On Wed, Jul 21, 2010 at 9:48 PM, Andrew Martin wrote: > This code was part of a Blender script to build a 3d bar graph, so I don't > know if understanding Blender is a prereq for understanding this code. The > function is for the axis labels. > > def label(text,position,orientation='z'): > txt

Re: [Tutor] Problems installing

2010-06-29 Thread Marc Tompkins
On Tue, Jun 29, 2010 at 10:35 PM, Andrew Martin wrote: > I just downloaded Python 2.6.5 onto my windows vista laptop. I am > attempting to install "escript version 3: Solution of Partial Differential > Equations (PDE) using Finite Elements (FEM)." I downloaded the files and > manually placed them

Re: [Tutor] TypeError when io.open is used

2010-06-27 Thread Marc Tompkins
On Sun, Jun 27, 2010 at 5:13 PM, wrote: > On Sun, 27 Jun 2010 15:56:23 -0700 > Marc Tompkins wrote: > >> On Sun, Jun 27, 2010 at 3:20 PM, wrote: >> >> I don't have any insight into your other piece of code, but here I think >> you >> just need ano

Re: [Tutor] TypeError when io.open is used

2010-06-27 Thread Marc Tompkins
On Sun, Jun 27, 2010 at 3:20 PM, wrote: > I have tried the following, too: > > from pg8000 import DBAPI > import os > import os.path > import sys > > # !!! that is test data. It must be changed > conn=DBAPI.connect(host="localhost", database="postgres", user="postgres", > password="test") > > #co

Re: [Tutor] OT: need computer advice from wise Tutors

2010-06-27 Thread Marc Tompkins
On Sun, Jun 27, 2010 at 7:41 AM, Alan Gauld wrote: > "Marc Tompkins" wrote > > having no default email client (what sort of two-bit operating system >> >>> doesn't have an email client in 2010?); >>> >>> Jesus, you _miss_ Outlook Expres

Re: [Tutor] OT: need computer advice from wise Tutors

2010-06-27 Thread Marc Tompkins
On Sat, Jun 26, 2010 at 4:46 PM, Steven D'Aprano wrote: > Apart from: > The OP was asking about upgrading from Vista to 7, so let me answer your objections here... having no default email client (what sort of two-bit operating system > doesn't have an email client in 2010?); > Jesus, you _miss_

Re: [Tutor] OT: need computer advice from wise Tutors

2010-06-26 Thread Marc Tompkins
On Sat, Jun 26, 2010 at 2:30 PM, Richard D. Moores wrote: > On Sat, Jun 26, 2010 at 13:39, Sithembewena Lloyd Dube > wrote: > > Hi Dick, > > > > In that case, perhaps you could externally back up all your important > stuff > > and then format your hard disk. That way, any drivers etc intended for

Re: [Tutor] Boa Constructor list control

2010-04-29 Thread Marc Tompkins
On Thu, Apr 29, 2010 at 11:07 PM, Ray Parrish wrote: > OK, I've discovered the collection editor, and now know how to use it, but > when I click the new button in the collection editor for a list control, it > pops up an error message stating that the list needs to be created with the > wx.LC_REP

Re: [Tutor] Guess my number? Guess what's wrong!

2010-04-17 Thread Marc Tompkins
On Sat, Apr 17, 2010 at 1:04 PM, Matthew Carpenter-Arevalo < matthew.carpenter.arev...@googlemail.com> wrote: > Hi Everyone, > > I'm a beginner python programmer, and I've been working on > the perennial 'guess my number' example. > > When I run this in my module, I get an infinite loop of 'higher

[Tutor] USB Access

2010-03-30 Thread Marc
ssile launcher code by Pedram Amini at dvlabs.tippingpoint.com, but am looking to see what else has been done in this area. thanks, Marc Sent from my Verizon Wireless BlackBerry ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscri

Re: [Tutor] Numpy unexpected result: subtraction of cell values

2010-01-11 Thread Marc Tompkins
On Mon, Jan 11, 2010 at 11:02 AM, Carnell, James E < jecarn...@saintfrancis.com> wrote: > > > > > I'm sure this is easy, but I am having a difficult time finding the > > right search terms to find it on the Internet. Any help much > > appreciated. > > > > 3 dimensional array(x,y,rgb) which is a PI

Re: [Tutor] Numpy unexpected result: subtraction of cell values

2010-01-11 Thread Marc Tompkins
On Mon, Jan 11, 2010 at 10:20 AM, Carnell, James E < jecarn...@saintfrancis.com> wrote: > > I'm sure this is easy, but I am having a difficult time finding the right > search terms to find it on the Internet. Any help much appreciated. > > 3 dimensional array(x,y,rgb) which is a PIL image into a n

Re: [Tutor] No beep from winsound.Beep(500, 500)

2009-12-19 Thread Marc Tompkins
Richard - It works (in Python 2.6, mind you) on my 64-bit Win7 machine, but I suspect that that may be because of Microsoft's compatibility twiddling on the back end. I Googled, and there seem to be a number of reports of people having trouble with 64-bit Vista and winsound.Beep(). I suspect tha

Re: [Tutor] mod_python authentication

2009-12-07 Thread Marc
> On Mo, 2009-12-07 at 09:35 -0400, Rayon wrote: > > How do I Check for an active login session on every page that > requires > > authentication > > > To understand sessions you first need to understand that HTTP is a > stateless protocol: you connect, send your request, receive a response > and th

Re: [Tutor] Iterable Understanding

2009-11-15 Thread Marc Tompkins
On Sun, Nov 15, 2009 at 4:11 PM, Stephen Nelson-Smith wrote: > > import gzip > > from heapq import heappush, heappop, merge > > Is this a preferred method, rather than just 'import heapq'? > > It has a couple of advantages: - convenience: if you "import heapq", then to do a push you need to type

Re: [Tutor] Sleep

2009-10-07 Thread Marc Tompkins
On Wed, Oct 7, 2009 at 4:01 PM, Hristos Giannopoulos wrote: > Is it possible for a python script to make a windows computer sleep or wake > from sleep? Preferably in windows? > I think your best bet for controlling Windows power management with Python will be the pywin32 module, at http://sourcef

Re: [Tutor] What language should I learn after Python?

2009-10-06 Thread Marc Tompkins
On Tue, Oct 6, 2009 at 12:39 PM, Mark Young wrote: > I'm now fairly familiar with Python, so I'm thinking about starting to > learn a second programming language. The problem is, I don't know which to > learn. I want a language that will be good for me to learn, but is not so > different from pyt

Re: [Tutor] New guy question...

2009-09-14 Thread Marc Tompkins
On Mon, Sep 14, 2009 at 12:30 PM, Warren wrote: > Type integers, each followed by ENTER; or just ENTER to finish > Traceback (most recent call last): >  method in test.py at line 9 >    line = input() > EOFError: EOF when reading a line > > Why is the "input" statement not waiting for input like

Re: [Tutor] Sending an email alert

2009-08-28 Thread Marc
> On Fri, Aug 28, 2009 at 3:00 PM, Marc wrote: > > Hello, > > > > > > > > I am trying to code an email alert and am running into the following > error: > > > >     s = smtplib.SMTP('smtp.marcd.org') > > > > AttributeError: '

[Tutor] Sending an email alert

2009-08-28 Thread Marc
h my email address and 'smtp.mydomain.org' with my domain email server. The error seems to say that the method or function SMTP does not exist within smtplib, but if I run the lines import smtplib s = smtplib.SMTP('smtp.mydomain.org

Re: [Tutor] No Elegant XML Output in ElementTree?

2009-07-27 Thread Marc Tompkins
On Mon, Jul 27, 2009 at 8:32 PM, Luis Galvan wrote: > Hi tutors, > Okay, so I just started to learn ElementTree (and XML processing in > general) and I just can't, for the life of me, find a way to output the XML > file in an actual hierarchic presentation. What you want is generically called "p

Re: [Tutor] if: else: can not get else to work

2009-07-07 Thread Marc Tompkins
On Tue, Jul 7, 2009 at 6:36 PM, David wrote: > My question is I tried to get it to print out when the directory was empty > like this; > > for file in fobj: >pathname = os.path.join(folder, file) >if os.path.exists(pathname): >print 'removing... ', file >os.remove(pathname

Re: [Tutor] When are strings interned?

2009-07-01 Thread Marc Tompkins
On Wed, Jul 1, 2009 at 5:29 PM, Robert Berman wrote: > > >>> n = "colourless" > > >>> o = "colourless" > > >>> n == o > > True > > >>> n is o > > True > > >>> p = "green ideas" > > >>> q = "green ideas" > > >>> p == q > > True > > >>> p is q > > False > > > > Why the difference? > > The string p

Re: [Tutor] Needing Help

2009-06-30 Thread Marc Tompkins
On Tue, Jun 30, 2009 at 12:27 PM, Bob Rea wrote: > Why doe sit work with a dob in 1943 and not with one in 1980 > then, that's what really bugs me > Nothing to do with the year. Your birth month is BEFORE June; her birth month is after. -- www.fsrtechnologies.com __

Re: [Tutor] delphi, pascal and Python

2009-05-20 Thread Marc Tompkins
On Wed, May 20, 2009 at 11:10 AM, Alan Gauld wrote: > > "Andy Cheesman" wrote > > Is there a Method for wrapping delphi and/or pascal code into python like >> SWIG? >> I've googled to no avail, Can anyone help me? >> > > Try this: > > http://membres.lycos.fr/marat/delphi/python.htm > > Alan G >

Re: [Tutor] why is unicode converted file double spaced?

2009-04-07 Thread Marc Tompkins
On Tue, Apr 7, 2009 at 11:59 AM, Pirritano, Matthew wrote: > I did get an error… > > > > Traceback (most recent call last): > > File "C:\Projects\unicode_convert.py", line 8, in > > outp.write(outLine.strip()+'\n') > > UnicodeEncodeError: 'ascii' codec can't encode characters in position >

Re: [Tutor] why is unicode converted file double spaced?

2009-04-07 Thread Marc Tompkins
On Tue, Apr 7, 2009 at 10:57 AM, Pirritano, Matthew wrote: > Excellent! Thanks Marc, Kent, and everyone. Marc your code worked. Now to > see if it will run on the full 4.5 GB file! : ) > Glad to help - but you should definitely take Kent's advice and replace my strip() with rstrip

Re: [Tutor] why is unicode converted file double spaced?

2009-04-07 Thread Marc Tompkins
On Tue, Apr 7, 2009 at 10:52 AM, Kent Johnson wrote: > You really should use rstrip(), leading white space is generally > significant in a text file, trailing white space not so much. > Good point. -- www.fsrtechnologies.com ___ Tutor maillist - Tu

Re: [Tutor] why is unicode converted file double spaced?

2009-04-07 Thread Marc Tompkins
On Tue, Apr 7, 2009 at 10:26 AM, Pirritano, Matthew wrote: > Thanks Marc, > > > > But I think that got rid of all of my carriage returns. Everything on just > one line now. > Sorry! My bad! Try this instead: > for outLine in inp: > outp.

Re: [Tutor] why is unicode converted file double spaced?

2009-04-07 Thread Marc Tompkins
On Tue, Apr 7, 2009 at 9:52 AM, Pirritano, Matthew wrote: > So Kent's syntax worked to convert my Unicode file to plain text. But > now my data is double space. How can I fix this. Here is the code I'm > using. > Sounds like you're being stung by the difference in newline handling between operat

[Tutor] Trouble Parsing XML using lxml

2009-04-03 Thread marc
or to it. I know I am missing something, but don't see it. Any assistance is appreciated. Thanks, marc ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] printing files

2009-03-26 Thread Marc Tompkins
On Thu, Mar 26, 2009 at 10:56 AM, Marc Tompkins wrote: > Without changing anything else, you could do it with a slice: > You should probably also close your input files when you're done with them. -- www.fsrtechnologies.com ___ Tut

Re: [Tutor] printing files

2009-03-26 Thread Marc Tompkins
On Thu, Mar 26, 2009 at 10:42 AM, Bala subramanian < bala.biophys...@gmail.com> wrote: >print>>out, handle <-- Here i want to write only from second line. I > dnt want to loop over handle here and putting all lines except the first one > in > anothe

Re: [Tutor] Syntax error

2009-03-22 Thread Marc Tompkins
On Sun, Mar 22, 2009 at 8:35 PM, John Jenkinson wrote: > I am trying to write a program that displays the string expression "Game > Over", in a console window that remains open. > > my code is as follows: > > # Game Over console window > > print "Game Over" > raw input("\n\nPress the enter key to

Re: [Tutor] Executing a C Program from RH Linux in Python for Win

2009-03-20 Thread Marc Tompkins
On Fri, Mar 20, 2009 at 10:02 AM, Marc Tompkins wrote: > Neither Python proper nor Popen() are actually executing the program - the > Windows shell/command interpreter does that (command.com or cmd.exe, > depending on your Windows version); Popen() is just a mechanism for making >

Re: [Tutor] Executing a C Program from RH Linux in Python for Win

2009-03-20 Thread Marc Tompkins
On Fri, Mar 20, 2009 at 10:02 AM, Marc Tompkins wrote: > If you want to run a non-Windows executable on Windows, you need to use an > alternate shell - someone mentioned Cygwin - although I'm not certain that > even that will do it for you. What makes an executable OS-specifi

Re: [Tutor] Executing a C Program from RH Linux in Python for Win

2009-03-20 Thread Marc Tompkins
On Fri, Mar 20, 2009 at 8:46 AM, Wayne Watson wrote: > I guess I haven't made clear above. This is a Red Hat Linux compiled C > program. Indications from others above, suggest it is possible to execute it > under Win Python. If that's true, then my guess is that something prior to > the call must

Re: [Tutor] Parse XML file

2009-03-15 Thread marc
these libraries in less than an hour and solve the problems I had encountered with minidom in a very short time. (BTW, parsing xml was probably a poor choice for my first project while learning Python, but then again, nobody has ever accused me of making my life easy) Marc

[Tutor] Issues Parsing XML

2009-03-10 Thread marc
Hello, I am new to Python and as a first project decided to try to parse an XML report using Python. I have the following, which works to extract one element. I am stuck, however, at one element. I want to extract several differenct elements per line, creating a comma separated variable (CSV) l

Re: [Tutor] What is this [] construction?

2009-03-04 Thread Marc Tompkins
On Tue, Mar 3, 2009 at 11:56 PM, Alan Gauld wrote: > > In Python v3 list comprehensions and generator expressions have been > "merged" in that putting a GE inside [] has the same effect as a LC. In > practice this makes little or no difference to the programmer its just how > Python handles it beh

Re: [Tutor] What is this [] construction?

2009-03-03 Thread Marc Tompkins
On Tue, Mar 3, 2009 at 7:01 PM, Lie Ryan wrote: > Marc Tompkins wrote: > > List comprehensions will make your head hurt the first few dozen times > >> you encounter them. After that, they become easier to use than the longer >> for-loop structure they replace - as Andr

Re: [Tutor] What is this [] construction?

2009-03-03 Thread Marc Tompkins
On Mon, Mar 2, 2009 at 11:18 PM, Andre Engels wrote: > On Tue, Mar 3, 2009 at 4:54 AM, Wayne Watson > wrote: > >self.recent_events = [ event for event in self.recent_events > >if os.path.exists(event) and > >(time.time() - o

Re: [Tutor] Converting "HH:MM:SS" to datetime

2009-03-01 Thread Marc Tompkins
On Sun, Mar 1, 2009 at 10:04 AM, Wayne Watson wrote: > Ok, how do I do what's mentioned in Subject? > One thing to be aware of - Python datetimes are just that: date + time. If you specify only the time, the date will be filled in with a default value - generally the beginning of the epoch for

Re: [Tutor] Looking for ConfigObj Documentation

2009-02-21 Thread Marc Tompkins
On Fri, Feb 20, 2009 at 2:19 PM, Wayne Watson wrote: > Good. Thanks. It works fine for me now. I deleted the file. I just ran > the program again straight from the py file, and it put my the black window > with my raw_input prompt. It seems odd that it wouldn't have left text > debris when it c

Re: [Tutor] Looking for ConfigObj Documentation

2009-02-21 Thread Marc Tompkins
On Sat, Feb 21, 2009 at 8:26 PM, Wayne Watson wrote: > I've found others like that, but I was looking for something more > descriptive. Things like typing fill-in, or cut/paste, use of F8, etc. I'd > guess there are more. > Click through a little further: http://www.ss64.com/nt/cmd.html Should t

Re: [Tutor] Looking for ConfigObj Documentation

2009-02-21 Thread Marc Tompkins
On Sat, Feb 21, 2009 at 6:42 PM, Wayne Watson wrote: > I tried XP's Help on command prompts. Not much there. Is there another > source? > There are lots, and Google knows most of them - here's a good one to start with: http://www.ss64.com/nt/ -- www.fsrtechnologies.com

Re: [Tutor] Looking for ConfigObj Documentation

2009-02-20 Thread Marc Tompkins
On Fri, Feb 20, 2009 at 5:05 PM, Wayne Watson wrote: > Not because of this particular problem, but, out of curiosity, I tried > today to give the MS command line facility a shot. I think that's what we > are discussing here. I immediately ran into something of a problem. My > assumption was is wa

Re: [Tutor] Looking for ConfigObj Documentation

2009-02-20 Thread Marc Tompkins
On Fri, Feb 20, 2009 at 10:45 AM, Paul McGuire wrote: > Has anyone already mentioned the article in Python Magazine, May, 2008? > No, I for one haven't seen it. Is it available online, or only for subscribers? -- www.fsrtechnologies.com ___ Tutor m

Re: [Tutor] Looking for ConfigObj Documentation

2009-02-20 Thread Marc Tompkins
On Fri, Feb 20, 2009 at 9:45 AM, Wayne Watson wrote: > Marc, I'm reaching back here, since something seems to have gone awry. I'm > looking at the code for Global_Config1.py. When I execute it from IDLE, I > get again: > > ... > File > "C:\San

Re: [Tutor] KeyError: 'DEFAULT'

2009-02-19 Thread Marc Tompkins
On Thu, Feb 19, 2009 at 8:39 PM, Lie Ryan wrote: > On Thu, 19 Feb 2009 11:45:52 -0800, Marc Tompkins wrote: > > Don't use reserved words as variable names! > > > str, set is built-in function not reserved words. Reserved words are like > if, for, from, as (see the w

Re: [Tutor] KeyError: 'DEFAULT'

2009-02-19 Thread Marc Tompkins
On Thu, Feb 19, 2009 at 11:34 AM, Isaac Eiland-Hall wrote: > http://python.pastebin.com/m26864a1b > > > > Traceback (most recent call last): > > File "./loopy", line 328, in > > > set[current_set][current_section][current_key] = current_value > > KeyError: 'DEFAULT' > One thing p

Re: [Tutor] Removing control characters

2009-02-19 Thread Marc Tompkins
On Thu, Feb 19, 2009 at 11:25 AM, Dinesh B Vadhia wrote: > My solution is: > > print ''.join[string.replace(c, r) for c in str if c in set] > > But, this returns a syntax error. Any idea why? > Probably because you didn't use parentheses - join() is a function. -- www.fsrtechnologies.com

Re: [Tutor] Looking for ConfigObj Documentation

2009-02-19 Thread Marc Tompkins
On Thu, Feb 19, 2009 at 10:59 AM, Wayne Watson wrote: > I'm willing to give vim a shot. I believe in an earlier thread unrelated to > this, Alan suggested it. I'm perhaps incorrectly assuming vim will take care > of the Tkinter problem. If these editors aren't really the source of some > the err

Re: [Tutor] Looking for ConfigObj Documentation

2009-02-19 Thread Marc Tompkins
On Thu, Feb 19, 2009 at 9:58 AM, Wayne Watson wrote: > I now have wxPython, IDLE and Vim installed. IDLE didn't disappear during > the wx install. It looks as though wxPython re-compiled library files. I'll > be exploring vim now. > wxPython doesn't replace or remove anything - I still have IDL

Re: [Tutor] Looking for ConfigObj Documentation

2009-02-19 Thread Marc Tompkins
On Thu, Feb 19, 2009 at 4:51 AM, Wayne Watson wrote: > Hi, actually I had two aims with the pseudo code, 1. print it, and 2. > check to see if it would pull in the two modules. I pulled it into Word, and > quickly formatted it to get the line wrap out, and put it in some sort of > readable format

Re: [Tutor] Looking for ConfigObj Documentation

2009-02-18 Thread Marc Tompkins
On Wed, Feb 18, 2009 at 7:42 PM, Wayne Watson wrote: > I took your "starter" code, and formatted it to be what I hope is an > acceptable program, Gobal_Config.py. See attached. I'm using Python 2.5.2. > I put the two modules in the same folder with it, and executed it in IDLE. I > got this: >

Re: [Tutor] Looking for ConfigObj Documentation

2009-02-18 Thread Marc Tompkins
On Wed, Feb 18, 2009 at 2:57 PM, Wayne Watson wrote: > Thanks. I recall installing several libraries though, where somehow they > were packaged to automatically install when opened. > > In the >

Re: [Tutor] Looking for ConfigObj Documentation

2009-02-18 Thread Marc Tompkins
important that the script not have the same name as a standard module, or Python will attempt to load the script as a module when that module is imported. This will generally be an error. See section *Standard Modules* <http://docs.python.org/tutorial/modules.html#tut-standardmodules>for more infor

Re: [Tutor] Looking for ConfigObj Documentation

2009-02-18 Thread Marc Tompkins
On Wed, Feb 18, 2009 at 7:30 AM, Wayne Watson wrote: > See Subject. I've run across a 58 page document > , > but am uncertain of its applicability to my present needs (see my thread on > "Changin

Re: [Tutor] Changing the Attribute of a Variable

2009-02-18 Thread Marc Tompkins
On Tue, Feb 17, 2009 at 7:09 PM, Wayne Watson wrote: I have a few notes, but first I just have to say: you're working very hard to implement an ordered dictionary, and you really, really don't need to. Python's (unordered) dictionaries work just fine for reading and writing configurations; you jus

Re: [Tutor] Changing the Attribute of a Variable

2009-02-17 Thread Marc Tompkins
On Tue, Feb 17, 2009 at 11:01 AM, Wayne Watson wrote: > Here's the print from the code line below. > > Second line from the top. > There it is - stop_time is a str at this point in the program, so has no strftime attribute or method. Step back through your code and see why... I find Control-F

Re: [Tutor] Changing the Attribute of a Variable

2009-02-17 Thread Marc Tompkins
On Tue, Feb 17, 2009 at 4:44 AM, Wayne Watson wrote: > Note that the diagnostic output in the image shows attributeError: 'str' > object has no attribute 'strftime'. > > Let me see if I clarify what's really going on by including some of the > code. > Everything in Python - both variables and cod

<    1   2   3   4   5   >