Re: [Tutor] Regular expression - I

2014-02-18 Thread Steve Willoughby
Because the regular expression means “match an angle-bracket character, zero or more H characters, followed by a close angle-bracket character” and your string does not match that pattern. This is why it’s best to check that the match succeeded before going ahead to call group() on the result

Re: [Tutor] Regular expression - I

2014-02-18 Thread Steve Willoughby
st paragraph for the above link. > > Thanks, > santosh > > > > On Tue, Feb 18, 2014 at 11:33 PM, Steve Willoughby wrote: > Because the regular expression means “match an angle-bracket character, > zero or more H characters, followed by a close angle-bracket character” and &

Re: [Tutor] Subprocess communications query

2013-12-10 Thread Steve Willoughby
Reuben wrote: >I want to implement a python script on machine A to do telnet/ssh into >machine B (this might be easy)and then run the Test.py (this is >challenging) >On 11-Dec-2013 1:05 AM, "Danny Yoo" wrote: > >> On Tue, Dec 10, 2013 at 11:28 AM, Reuben >wrote: >> > Hi, >> > >> > There exists t

Re: [Tutor] Removing Unnecessary Indentation and other problems

2013-11-15 Thread Steve Willoughby
On your first question, make sure you have the right version of Tcl/Tk for your system (usually a tar.gz file is for Unix-like systems, although some programs like WinZip can read those files too). You may be able to get help from a Tcl/Tk forum on specifics of building that. However, doesn't

Re: [Tutor] Nested lists help

2013-10-18 Thread Steve Willoughby
On 18-Oct-2013, at 17:13, Corinne Landers wrote: > self.grid_x = x > self.grid_y = y > self.grid_z = z > > self.grid = [] > self.grid2D = [] > So here you create a list, self.grid2D. > for i in range(self.grid_y): > row = [0]*x > self.grid2D.append(row) > Here you a

Re: [Tutor] postgresql was: Re: Tutor Digest, Vol 115, Issue 6

2013-09-04 Thread Steve Willoughby
On 04-Sep-2013, at 14:28, Alan Gauld wrote: > On 03/09/13 08:25, Ismar Sehic wrote: >> help with postgres and csv: >> i solved my problem by playing with the sql line a little. >> it looked like this : sql = " UPDATE hotel SET path_picture = >> "+"';"+hotel_url+"' >> WHERE code LIKE '"+"%"+hotel

Re: [Tutor] Unix Environment variables

2013-06-23 Thread Steve Willoughby
Note, however, that changing environment variables only affects the environment of your script and it's child processes. Once your script exits, the original shell you called it from is NOT changed. Sent from my iPad On 2013/6/23, at 14:35, Amit Saha wrote: > Hello, > > On Tue, Jun 18, 2013

Re: [Tutor] Is there a programmatic use for keys() and values()

2013-06-16 Thread Steve Willoughby
On 16-Jun-2013, at 11:35, Steven D'Aprano wrote: > On 17/06/13 03:59, Steve Willoughby wrote: >> >> On 16-Jun-2013, at 10:49, Jim Mooney wrote: >> >>> On 16 June 2013 01:43, Roel Schroeven wrote: >>> >>>> Can't you disable tha

Re: [Tutor] Is there a programmatic use for keys() and values()

2013-06-16 Thread Steve Willoughby
On 16-Jun-2013, at 10:49, Jim Mooney wrote: > On 16 June 2013 01:43, Roel Schroeven wrote: > >> Can't you disable that behavior somewhere in the settings of your IDE? I >> know IDEs do that to be helpful, but I don't like it and so far I've been >> able to disable it in all IDEs I've used. >

Re: [Tutor] Hi, First question

2013-06-16 Thread Steve Willoughby
On 16-Jun-2013, at 09:21, Mark Lawrence wrote: > On 16/06/2013 16:55, Chris “Kwpolska” Warrick wrote: >> On Sat, Jun 15, 2013 at 7:22 AM, Patrick Williams wrote: >>> Hi so I am making a bit of code to extract a bit of numbers data from a file >>> and then find the average of that data, however

Re: [Tutor] python web related scripts needed

2013-06-16 Thread Steve Willoughby
On 12-Jun-2013, at 05:48, Manigopal Vepati wrote: > Hi, > > I need scripts for the following . > > 1) check whether username and password fields are present in Gmail > 2) Code to access the system which doesn’t have ip address > And what have you found as you've started writing those scripts

Re: [Tutor] Value Error

2013-06-12 Thread Steve Willoughby
int('blah') is not a type error because the int() function is expecting to be given a string, and it was given a string. The 'blah' is of the correct type. The problem is that int() couldn't do anything useful with the value of that string. Steve On 12-Jun-2013, at 14:41, Jim Mooney wrote: >

Re: [Tutor] Value Error

2013-06-12 Thread Steve Willoughby
or if you try to take the square root of a negative number, etc. On 12-Jun-2013, at 14:06, Sander Sweers wrote: > On 06/12/2013 10:49 PM, Jim Mooney wrote: >> Raised when a built-in operation or function receives an argument that has >> the right type but an inappropriate value, and the situatio

Re: [Tutor] why can you swap an immutable tuple?

2013-05-25 Thread Steve Willoughby
On 2013-5月-25, at 上午11:56, Jim Mooney wrote: > I thought tuples were immutable but it seems you can swap them, so I'm > confused: > > a,b = 5,8 > I think you're confusing mutating the tuples with assigning the immutable tuples different names. The variable names are just labels you attach

Re: [Tutor] if/else option for making a choice

2013-02-18 Thread Steve Willoughby
For example, making a function that asks each question and handles all the different ways the user might answer other than typing precisely "yes". Or putting the choices in a list instead of repeating the choice-asking code over and over. -- Steve Willoughby| Using billion-dollar s

Re: [Tutor] following on

2013-02-18 Thread Steve Willoughby
None of these are C/C++ things. They are basic building-blocks of Computer Science and data structures you'll use regardless of language. I'd really recommend investing some time reading up on these and other fundamental data structures. -- Steve Willough

Re: [Tutor] Python Question

2013-01-09 Thread Steve Willoughby
On 2013-1月-7, at 下午3:31, Dylan Kaufman wrote: > Greetings, > > I take Computer Science in school and for a Python program, I have: > > from winsound import Beep > The first thing I notice is "from winsound import …" Could that be a WINDOWS library which might not work on a Macintosh? > Bee

Re: [Tutor] optparse.OptionParser options in alphabetical order in help display

2012-12-18 Thread Steve Willoughby
Although it is probably too obvious to be the answer you're looking for, why can't you just add them in order in the source code? This way, you can arrange them however you want them to appear, instead of python arbitrarily enforcing its own order. Python likes being explicit about things like

Re: [Tutor] help me decide

2012-09-05 Thread Steve Willoughby
ight. Although Java here doesn't necessarily mean the JVM is running on the embedded machine; it could be Java source code compiled down to something a compact runtime can execute. -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that is not what ships are built for.&q

Re: [Tutor] understanding pydoc try

2012-08-30 Thread Steve Willoughby
d by something. Maybe it would help to start by describing your grammar to YACC, getting it to work, and then expressing that back out as BNF (or just leaving it in YACC code). -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that is not what ships are built for.&q

Re: [Tutor] Recursion always returns None

2012-08-28 Thread Steve Willoughby
l!" factor when you first discover recursion. When it naturally applies to a problem, it's still a powerful thing, but yes, it's often misapplied by beginners. -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that is not what ships are built for."

Re: [Tutor] Recursion always returns None

2012-08-28 Thread Steve Willoughby
to be concerned with efficiency for a hangman game? Not the game per se, but if you're searching a file of thousands of words one at a time, randomly picking words and recursing if they're not what you intended, the hit--worst case--could be catastrophic. -- Steve Willoughby / st...@alch

Re: [Tutor] Recursion always returns None

2012-08-28 Thread Steve Willoughby
rint word [/code] Sample output : $ python hangman.py How long word can you guess (number of alphabets) : 6 Should return inarch None $ The problem is that the last line "print word" always prints None. I know I am doing something wrong in the recursion part of the function "pick_ra

Re: [Tutor] finally without try or except

2012-07-30 Thread Steve Willoughby
interrupted in the middle of something? I think the block above will do what you're asking for, but I'm not sure what you're asking for is what will help you best. -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that is not what ships are built for.&q

Re: [Tutor] Concatenating Strings

2012-05-28 Thread Steve Willoughby
ating other string values. a="hello" b="world" a+b# will yield "helloworld" but a b# is a syntax error Using + is arguably preferable when you have a choice to make, since it works in all cases, including constants. -- Steve Willoughby / st...@alchemy.com

Re: [Tutor] feedback on writing pipelines in python

2012-03-21 Thread Steve Willoughby
On 21-Mar-12 11:03, Abhishek Pratap wrote: Hi Guys I am in the process of perl to python transition for good. I wanted to Why? Perl is still a perfectly good tool. Just not, IMHO, good for exactly the same things Python is good for. 1. stitch pipelines : I want python to act as a glue

Re: [Tutor] question on self

2012-03-11 Thread Steve Willoughby
lling a function bound to a particular object, so by saying self.TakeTurns(), Python knows that the object "self" is invoking that method, not some other instance of the Play class. That method then can access all of that specific object's attributes as necessary. -- Steve Willough

Re: [Tutor] decimal precision in python

2012-02-07 Thread Steve Willoughby
On 07-Feb-12 03:15, Steven D'Aprano wrote: Steve Willoughby wrote: If you need lots of precision, you might consider using the decimal class. It'll cost you speed vs. the native floating-point type but won't cause you round-off errors. I'm afraid that's not correct.

Re: [Tutor] decimal precision in python

2012-02-06 Thread Steve Willoughby
python which can at least repeat previous command with a key stroke I use vim, which has that feature. I suspect any editor worth its salt does, or could be programmed to. -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that is not what ships are built for."

Re: [Tutor] SEE THE QUESTION AT THE BOTTOM

2012-02-03 Thread Steve Willoughby
ge IN ALL CAPITAL LETTERS; it gives the impression you are shouting at your audience. HTH, HAND -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that is not what ships are built for." PGP Fingerprint 4615 3CCE 0F29

Re: [Tutor] Error Checking/Defensive Programming

2012-01-25 Thread Steve Willoughby
th integers like 0, it will either be >= 0 or < 0, so the condition will always be true. If "number" contains something that doesn't make sense to compare like that, then it just won't work (i.e., it'll likely throw an exception). (usually :) -- Steve Willoughby / st

Re: [Tutor] Weird Try..Except Error

2011-11-25 Thread Steve Willoughby
nterpreter, PATH notwithstanding. steve -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that is not what ships are built for." PGP Fingerprint 4615 3CCE 0F29 AE6C 8FF4 CA01 73FE 997A 765D 696C ___ Tutor maillist - Tutor@python.or

Re: [Tutor] Question on List Comprehensions

2011-11-22 Thread Steve Willoughby
ulting in: [[str(x+1), x+1] for x in range(size)] Also, if you didn't like the repeated x+1 in there, you could just change the range call to go from 1..size directly: [[str(x), x] for x in range(1,size+1)] -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, b

Re: [Tutor] \x00T\x00r\x00i\x00a\x00 ie I get \x00 breaking up every character ?

2011-11-20 Thread Steve Willoughby
r), you'll destroy them by killing the null bytes and won't handle the case of that high-order byte being something other than zero. Check out Python's Unicode handling, and character set encode/decode features for a robust way to translate the output you're getting. Ch

Re: [Tutor] \x00T\x00r\x00i\x00a\x00 ie I get \x00 breaking up every character ?

2011-11-20 Thread Steve Willoughby
hon.org <mailto:Tutor@python.org> To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman

Re: [Tutor] \x00T\x00r\x00i\x00a\x00 ie I get \x00 breaking up every character ?

2011-11-20 Thread Steve Willoughby
Where did the string come from? It looks at first glance like you have two bytes for each character instead of the one you expect. Is this perhaps a Unicode string instead of ASCII? Sent from my iPad On 2011/11/20, at 10:28, dave selby wrote: > Hi All, > > I have a long string which is an

Re: [Tutor] Question about GUI applications.

2011-11-08 Thread Steve Willoughby
ion window. To test, I made a "G" image and installed it. Here's a screenshot of the app window with and without that code. -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that is not what ships are built for." PGP Fingerprint 4615 3CCE 0F29

Re: [Tutor] Beginning Python From Perl

2011-11-08 Thread Steve Willoughby
ords. (Substitute "Perl" and "Python" with arbitrary languages of your choice.) -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that is not what ships are built for." PGP Fingerprint 4615 3CCE 0F29 AE6C 8FF4 CA01 73FE 997A 765D 696C

Re: [Tutor] Question about GUI applications.

2011-11-08 Thread Steve Willoughby
e is: root = Tkinter.Tk() root.iconbitmap(default=ico_image_filename) (on Linux I use root.iconbitmap(bitmap='@'+xbm_filename)) -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that is not what ships are built for." PGP Fingerprint 4615

Re: [Tutor] GNU Emacs and Python

2011-11-01 Thread Steve Willoughby
On 01-Nov-11 13:24, Steve Willoughby wrote: On 01-Nov-11 13:19, Alexander Etter wrote: I like than .png image! It does appear vi biased though! Not quite, notice the initial steep climb. :) Yes, it's tongue-in-cheek, Oops, my mistake. If the y axis is productivity and x is time usin

Re: [Tutor] GNU Emacs and Python

2011-11-01 Thread Steve Willoughby
operations involving text files. You think emacs is bad, though? Try TECO. -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that is not what ships are built for." PGP Fingerprint 4615 3CCE 0F29 AE6C 8FF4 CA01 73FE 997A 765D 696C _

Re: [Tutor] login window using Tk

2011-11-01 Thread Steve Willoughby
r the duration. Everything else is handled by the application's logic. For example, you'd display the login toplevel window, and when it's satisfied, it can trigger the functionality which creates (or displays the pre-created but hidden) application window and dismisses the login t

Re: [Tutor] beginner question

2011-11-01 Thread Steve Willoughby
o respond to that by yielding up a line from the file for every iteration. You could, theoretically, write a variation of the file object class which iterated over characters, or logical blocks (records of some sort) within files, and so forth. -- Steve Willoughby / st...@alchemy.com "A sh

Re: [Tutor] changing dictionary to lowercase

2011-10-27 Thread Steve Willoughby
comprehensions. Does that nudge you in the right direction? If you're still stuck, let us know. --steve -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that is not what ships are built for." PGP Fingerprint 4615 3CCE 0F29 AE6C 8FF4 CA01 73FE 997A 765D 69

Re: [Tutor] string immutability

2011-10-24 Thread Steve Willoughby
behind the scenes for you. -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that is not what ships are built for." PGP Fingerprint 4615 3CCE 0F29 AE6C 8FF4 CA01 73FE 997A 765D 696C ___ Tutor maillist - Tutor@python.org To

Re: [Tutor] string immutability

2011-10-24 Thread Steve Willoughby
g over a detail about how Python variables realy work, but that's another topic). > >>> s = "Second" > >>> print s > Second Now you created a new string object with the value "Second" and stored THAT into s, replacing the original

Re: [Tutor] password loop

2011-09-23 Thread Steve Willoughby
;re new to programming) to step through the instructions you've written for the computer, one at a time, and repeat to yourself what each step is accomplishing. -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that is not what ships are built for." PGP F

Re: [Tutor] Confirmation if command worked

2011-08-25 Thread Steve Willoughby
On 25-Aug-11 01:37, Christian Witts wrote: Good catch, it should be `if child.exitstatus != None and child.exitstatus == 0:` It's better form to say if child.exitstatus is not None instead of comparing for equality to None with the != operator. -- Steve Willoughby / st...@alchem

Re: [Tutor] inserting degrees symbol in plot title

2011-08-09 Thread Steve Willoughby
he special character. -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that is not what ships are built for." PGP Fingerprint 4615 3CCE 0F29 AE6C 8FF4 CA01 73FE 997A 765D 696C ___ Tutor maillist - Tutor@pytho

Re: [Tutor] How to get the keys of a dict inside a dict. ValueError: too many values to unpack

2011-08-08 Thread Steve Willoughby
On Mon, Aug 8, 2011 at 9:41 AM, Steve Willoughby mailto:st...@alchemy.com>> wrote: Either way, once you have the list of the keys you want to display, print them out once as column headings -- Odeyemi 'Kayode O. http://www.sinati.com. t: @charyorde -- Steve Willoughby / st

Re: [Tutor] How to get the keys of a dict inside a dict. ValueError: too many values to unpack

2011-08-08 Thread Steve Willoughby
to a class. That way you can define the attributes of each object and even implement a print() method (or at least define __str__() and/or __repr__() methods) to print each object sensibly. -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that is not what ships are bu

Re: [Tutor] How to get the keys of a dict inside a dict. ValueError: too many values to unpack

2011-08-07 Thread Steve Willoughby
On 07-Aug-11 09:17, Steve Willoughby wrote: First of all, that's not a dict. It's just a tuple of strings. so, when you say: #loop through and get the keys of each for k,v in x: You'll get one iteration, where k=the first string and v=the second. However, you ignore k and v

Re: [Tutor] How to get the keys of a dict inside a dict. ValueError: too many values to unpack

2011-08-07 Thread Steve Willoughby
but printing its last value after the loop exits. Is that what you intended? You're expecting Python to take a string that looks like Python source code and know that you want it to be interpreted as source code. Instead of using string values, use actual Python syntax directly, like:

Re: [Tutor] Running Python in script vs. Idle

2011-07-24 Thread Steve Willoughby
will take the extra step of printing the value of that expression for you. That's not otherwise how Python works. Normally you have to use a print command (or print() function in Python 3.x) to actually see the output. -- Steve Willoughby / st...@alchemy.com "A ship in harbor is

Re: [Tutor] Basic question on spaces

2011-07-19 Thread Steve Willoughby
quot; Okay, based on that bill, a 15% tip would be ${0}, and a 20% tip would be ${1}. """.format(percent15, percent20) -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that is not what ships are built for." PGP Fingerprint 4615 3CCE 0F29 AE6C 8FF4 CA0

Re: [Tutor] compare and arrange file

2011-07-11 Thread Steve Willoughby
t does this for column 3's value. Now run through the column 2 data you saved, print that data row, then look up the value in the other dictionary and print that after it. On Mon, Jul 11, 2011 at 7:55 PM, Steve Willoughby wrote: On 11-Jul-11 16:50, Edgar Almonte wrote: Thanks for the

Re: [Tutor] compare and arrange file

2011-07-11 Thread Steve Willoughby
? Does it matter which ones you match up? If so, how do you decide? -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that is not what ships are built for." PGP Fingerprint 4615 3CCE 0F29 AE6C 8FF4 CA01 73FE 997A 765D 696C ___

Re: [Tutor] problem reading script

2011-07-01 Thread Steve Willoughby
be weird I tried using an old OCR font and kind of got to like that too. A little weird but the glyphs are certainly distinct :) -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that is not what ships are built for." PGP Fingerprint 4615 3CCE 0F29 AE6C 8FF4 CA01

Re: [Tutor] Weird tkFont behavior

2011-06-17 Thread Steve Willoughby
tting happier to see the improvements to what you can do with just plain Tkinter since the last time I used it seriously. Tkinter and ttk do have the advantage of already being right there in the standard library. -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that is

Re: [Tutor] Beginner puzzle with unpacking argv

2011-06-16 Thread Steve Willoughby
two values from it. For more sophisticated argument handling, you could look at the optparse or argparse modules (but that's beyond the beginner level--something to keep in mind for later). -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that is not what ships are b

Re: [Tutor] Weird tkFont behavior

2011-06-16 Thread Steve Willoughby
On 16-Jun-11 09:52, Steve Willoughby wrote: I'm probably just doing something stupid, but I can't spot the error. I hope someone here can see what I'm looking past, or knows of a known issue with these widgets. I think I solved it, actually.. as I was typing this up, I wonde

[Tutor] Weird tkFont behavior

2011-06-16 Thread Steve Willoughby
xt is inserted simply by: f.insert(END, text, 'rm') and yet some of the time, even though the 'rm' tag is there, I get one of the other fonts I configured for the other tags. Do I need to keep other references to the tkFont objects somewhere else or something? -- Steve W

Re: [Tutor] Communicating Between Programs Using Raw Inputs

2011-06-14 Thread Steve Willoughby
ed and the output substituted back on the command line. The < bracket means to take what follows it as a file NAME (not a data stream). So unless writer.py outputs a filename, you really want something like python writer.py | python reader.py -- Steve Willoughby / st...@alchemy.com "

Re: [Tutor] Communicating Between Programs Using Raw Inputs

2011-06-14 Thread Steve Willoughby
ogram, and have a file-like object on which it can write data, which the child program will see as its standard input (and read in to raw_input). -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that is not what ships are built for." PGP Fingerprint 4615 3CCE 0

Re: [Tutor] trying to translate and ebcidic file

2011-06-14 Thread Steve Willoughby
e and the other. of course, if you are on a Unix-like system, there's already a command for that, to convert a file "E" from EBCDIC to a file "A" in ASCII: $ dd if=E of=A conv=ascii or the other way: $ dd if=A of=E conv=ebcdic -- Steve Willoughby / st...@alchemy.com

Re: [Tutor] Objects C++ vs Python

2011-06-09 Thread Steve Willoughby
On 08-Jun-11 23:33, Ashwini Oruganti wrote: On Thu, Jun 9, 2011 at 11:31 AM, Steve Willoughby mailto:st...@alchemy.com>> wrote: The value 5 is an integer-class object. But now what is "Integer-class"? Isn't integer a data type? I mean there is no concept of "c

Re: [Tutor] Objects C++ vs Python

2011-06-08 Thread Steve Willoughby
That has nothing to do with what an "object" means. So does the term *Object * change its meaning when we shift the context from C++ to python?? This is a little confusing, can someone clear it up?? Not really. I think your confusion was about variables. -- Steve Willoughby / st..

Re: [Tutor] create an xls file using data from a txt file

2011-05-12 Thread Steve Willoughby
he application. Where in the application, though, this is dealt with is not where I think we disagree. In my original response, I clarified that, although as a short parenthetical note: On 12-May-11 02:25, Peter Otten wrote: Steve Willoughby wrote: Actually, yes, that's exactly what Pyt

Re: [Tutor] create an xls file using data from a txt file

2011-05-11 Thread Steve Willoughby
.py /temp/myfile That works because Windows hands ALL of the argument strings, as-is, with NO interpretation, to the application to deal with. In this case, the application is Python, and Python is going to the extra work to interpret the / characters as \ characters when you try to use them in open

Re: [Tutor] create an xls file using data from a txt file

2011-05-11 Thread Steve Willoughby
ry separators). Core windows commands don't generally accept it, including native Windows applications (although sometimes they're lenient in what they accept). It'll work for command-line Python script usage because it's *python* that allows them, not *windows*. -- Steve W

Re: [Tutor] Reading elements in a file

2011-05-04 Thread Steve Willoughby
side "" quotes and ignore the commas. Or split on ',' then strip quotes, or... CSV is easiest if that's a match for your problem domain. -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that is not what ships are built for." PGP Fingerprint

Re: [Tutor] Just started Python

2011-04-27 Thread Steve Willoughby
y...except block to do the typecast. -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that is not what ships are built for." PGP Fingerprint 4615 3CCE 0F29 AE6C 8FF4 CA01 73FE 997A 765D 696C ___ Tutor maillist - Tutor@pyt

Re: [Tutor] Run a few Python commands from a temporary filesystem when the rootfs is halted

2011-04-22 Thread Steve Willoughby
y. If your question has more to do with the particulars of managing chroot()ed mountpoints or preparing LiveOS images, you'd need to look to a forum devoted to that. -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that is not what ships are built f

Re: [Tutor] Run a few Python commands from a temporary filesystem when the rootfs is halted

2011-04-22 Thread Steve Willoughby
what you think they mean, or I'm missing what you're trying to do here. halting the root filesystem? pivot? code base? You're not trying to talk about jail/chroot, perhaps? -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that is not what ships are bu

Re: [Tutor] (no subject)

2011-04-22 Thread Steve Willoughby
ut usually indentation errors say that they are indentation errors. Look carefully at your parentheses. Does every ( have a matching )? -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that is not what ships are built for." PGP Fingerprint 4615 3CCE 0F29 AE6C 8FF4 CA01

Re: [Tutor] Python trouble

2011-04-22 Thread Steve Willoughby
has the >>>s in it. How, exactly, does what I just described differ from what happened to you? -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that is not what ships are built for." PGP Fingerprint 4615 3CCE 0F29 AE6C 8FF4 CA01 73FE 997A 765D 696C __

Re: [Tutor] (no subject)

2011-04-22 Thread Steve Willoughby
On 22-Apr-11 15:48, Brad Desautels wrote: Ya, I did try to run it and I am getting a syntax error before it runs. and the message said? Where did it point to as the syntax error? ___ Tutor maillist - Tutor@python.org To unsubscribe or change s

Re: [Tutor] (no subject)

2011-04-22 Thread Steve Willoughby
On 22-Apr-11 15:37, Brad Desautels wrote: Hello, I am just learning Python 3.0 and I am working on this problem. I need to know what the output would be.Can anybody help What is your question? If you want to see what its output would be... run it and see the output. Is there more to your que

Re: [Tutor] Problem with running Python

2011-04-22 Thread Steve Willoughby
ve things like "Python 2.7.1" or ">>>" showing up in your source code. -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that is not what ships are built for." PGP Fingerprint 4615 3CCE 0F29 AE6C 8FF4 CA01 73FE 997A 765D 696C ___

Re: [Tutor] adding to PYTHONPATH

2011-04-19 Thread Steve Willoughby
t you probably want this to be a permanent change, so you need to edit the start-up file for your shell (.cshrc, .bashrc, .profile, whatever) and add an instruction to set that variable everytime you open a shell. -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that is not

Re: [Tutor] working with strings in python3

2011-04-19 Thread Steve Willoughby
a blending of "variables", "pointers" and "references" which just "do the right thing" most of the time due to how Python manages variable access. But they are not quite the same as any of those in other languages. -- Steve Willoughby / st...@alchemy.com

Re: [Tutor] working with strings in python3

2011-04-18 Thread Steve Willoughby
is impossible because that would be altering the string object named by "message" in-place, which is disallowed for strings. -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that is not what ships are built for."

Re: [Tutor] os.chdir() will not accept string variable

2011-04-15 Thread Steve Willoughby
inputData = inputFile.readlines() inputFile.close() os.chdir( r'%s' % inputData[0] ) newNames = [] oldNames = glob.glob( '*.*' ) for index, item in enumerate( oldNames ): print index, item if __name__ == '__main__': mdf()

Re: [Tutor] Platform Independence in Python

2011-04-06 Thread Steve Willoughby
th platforms. Are you running the same code on both platforms? The correct name is "Tkinter" (capital T) for Python 2.x, and "tkinter" (lower-case) for Python 3.x, regardless of platform. -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that

Re: [Tutor] RE

2011-04-06 Thread Steve Willoughby
On 06-Apr-11 02:03, JOHN KELLY wrote: I need help. Can you be a little more specific? :) -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that is not what ships are built for." PGP Fingerprint 48A3 2621 E72C 31D9 2928 2E8F 6506 DB29

Re: [Tutor] String formatting question.

2011-03-31 Thread Steve Willoughby
onary step to take. Especially so if your formats are configurable or generated by code which may want to reorder the values. -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that is not what ships are built for." PGP Fingerprint 48A3 2621 E72C 31D9 2928 2E8F

Re: [Tutor] Regex question

2011-03-30 Thread Steve Willoughby
eans to replace the second match. This can be yet simpler by using raw strings: r"\2'" Since in raw strings, backslashes do almost nothing special at all, so you don't need to double them. I should have thought of that when sending my original answer to your questi

Re: [Tutor] Regex question

2011-03-30 Thread Steve Willoughby
object: pattern = re.compile(r'(l|L|n|N)') and then substitute by calling its sub() method: text = pattern.sub('\1e', text) -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that is not what s

Re: [Tutor] accessing another system's environment

2011-02-26 Thread Steve Willoughby
g To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that is not what ships are built for." PGP Fingerprint 48A3 2621 E72C 31D9 2928 2E8F 6506 DB29 54F7 0F53 _

Re: [Tutor] accessing another system's environment

2011-02-25 Thread Steve Willoughby
On 25-Feb-11 20:26, Bill Allen wrote: On Fri, Feb 25, 2011 at 21:33, Steve Willoughby mailto:st...@alchemy.com>> wrote: On 25-Feb-11 19:27, Steve Willoughby wrote: Or are you saying you want to, from a remote Unix system, reach out to a Windows system and see that W

Re: [Tutor] accessing another system's environment

2011-02-25 Thread Steve Willoughby
On 25-Feb-11 19:27, Steve Willoughby wrote: Wait. Are you trying to figure out how, on a Unix system, to read Unix system environment variables as you're accustomed to doing on Windows? Or are you saying you want to, from a remote Unix system, reach out to a Windows system and see

Re: [Tutor] accessing another system's environment

2011-02-25 Thread Steve Willoughby
python.org <mailto:Tutor@python.org> To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor -- Stev

Re: [Tutor] accessing another system's environment

2011-02-24 Thread Steve Willoughby
your script to be executed in that environment. Finding the environment of a running process can be done easily, too. Look at the output of "ps" with certain options set, or the contents of files in /proc. However, remember that there are as many environments are there are processes

Re: [Tutor] Python object

2011-02-24 Thread Steve Willoughby
Tutor maillist - Tutor@python.org <mailto:Tutor@python.org> To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org To unsubscribe

Re: [Tutor] remote code execution

2011-02-15 Thread Steve Willoughby
hanks! It seems like the ideal case would be to run a remote desktop session onto the target system and develop there (e.g., run Eclipse or your favorite IDE on the Linux box, using it via VNC or something). Then you're running the real code on the real system. -- Steve Willoughby / st...@alch

Re: [Tutor] Help on RE

2011-01-22 Thread Steve Willoughby
s a digit character. \d+ matches one or more digit characters. Nothing in your regex matches a sign character. You might want something like [-+]\d+ which would require either a - or + followed by digits. If you want the sign to be optional, maybe this would work: [-+]?\d+ -- Steve Wil

Re: [Tutor] no luck with sqlinsert

2011-01-14 Thread Steve Willoughby
On 14-Jan-11 09:03, Jason Staudenmayer wrote: Don't build you sql separate from the execute (or so I was told when I was doing something similar) cur.execute(INSERT INTO tkindbtal (kommune, komnr, i2005, i2006, i2007 \ , i2008, i2009, i2010) VALUES (%s, %s, %s, %s, %s, %s,\ %s, %s)% (cols[0], col

Re: [Tutor] How to insert a quit-Button in a Tkinter class?

2011-01-12 Thread Steve Willoughby
is the quit() method actually defined? -- Steve Willoughby / st...@alchemy.com "A ship in harbor is safe, but that is not what ships are built for." PGP Fingerprint 48A3 2621 E72C 31D9 2928 2E8F 6506 DB29 54F7 0F53 ___ Tutor maillist - T

Re: [Tutor] vim as a python editor; FOLLOW-UP QUESTION

2010-12-16 Thread Steve Willoughby
as the up-arrow command history feature and is also good for Python coding in general? If you use the up-arrow to move your cursor to previous lines in the IDLE window and hit ENTER, you recall that line where you can edit and re-enter it. -- Steve Willoughby / st...@alchemy.com "A ship in

Re: [Tutor] How to pass a python variable to subprocess.call?

2010-10-25 Thread Steve Willoughby
On 25-Oct-10 15:19, Abhijeet Rastogi wrote: subprocess.call("ls -l "+mydir,shell=True) will do the job. In python, we can simply concatenate the strings like that. How do I replace /usr/local/bin in the subprocess call with the mydir variable? It's often preferable (for reasons ranging

  1   2   3   >