Re: [Tutor] An Introduction and a question (continuing)

2006-06-09 Thread Python
On Fri, 2006-06-09 at 16:28 -0500, Michael Sullivan wrote: > OK. I've got it working this far. Now I want the script to generate > eight pieces, each with a random colour. Here's my current code: > > #!/usr/bin/env python > > import random > impor

Re: [Tutor] connect to a remote machine - Linux

2006-06-11 Thread Python
On Sun, 2006-06-11 at 15:19 +, Patricia wrote: > Hi All, > > I need to connect to a remote computer on the same network to store data into > its mysql database, and I need to do this using python script. > > Although I've used mysql and python before, I have

Re: [Tutor] connect to a remote machine - Linux

2006-06-11 Thread Python
omputers. It listens on port 3306. There are network setup and security issues, but those would be outside the scope of a Python database program. > I read somewhere that os.popen would work, but I'm not sure if that > will do for me because I have to enter a passphrase and password to

Re: [Tutor] assignment statements in python

2006-06-11 Thread Python
On Sun, 2006-06-11 at 22:14 -0400, Kermit Rose wrote: > Message: 1 > Date: Sun, 11 Jun 2006 06:58:39 -0400 > From: Kent Johnson <[EMAIL PROTECTED]> > Subject: Re: [Tutor] buggy bug in my program > Cc: tutor@python.org > > Assignment in Python is not a copy, it is

Re: [Tutor] assignment statements in python

2006-06-12 Thread Python
On Mon, 2006-06-12 at 09:37 -0400, Kermit Rose wrote: > > From: Python > Date: 06/11/06 22:59:38 > To: Kermit Rose > Cc: Tutor Python > Subject: Re: [Tutor] assignment statements in python > > > The basic python objects: numbers, strings, and tuples are

Re: [Tutor] sorting in python

2006-06-12 Thread Python
On Mon, 2006-06-12 at 11:26 -0400, Kermit Rose wrote: > # to insert 3 between 2 and 4 in > > B = [1,2,4,5] > > B.append(B[3:3]) >>> B[3:3] [] >>> B[3:4] [5] >>> B[0:1] [1] >>> B[:2] [1, 2] >>> B.append(B[3:3]) >>> B [1, 2, 4, 5, []] > > # I expected B[4] to have the value 5 at this point.

Re: [Tutor] I Give Up.

2006-06-17 Thread Python
ead* the other sections. > > all I want to do is parse a *SIMPLE* config file of name = value pairs > and have python objects named by the name holding the value signified by > value , and I want it to be able to work *WITHOUT* someone having to > download and install additional

Re: [Tutor] I Give Up.

2006-06-17 Thread Python
On Sat, 2006-06-17 at 16:44 -0400, Brian Gustin wrote: > Now can someone explan how exactly (preferrably with an actual real > world example) that I can read a configuration file in , say > /etc/local-config/myconfig.cfg into my python script running in > /usr/bin/localscripts ,

Re: [Tutor] Writing to a remote file

2006-06-19 Thread Python
ur local file system. You'd use linux commands something like: mkdir logfiles mount -t smbfs //remote/logs ./logfiles That assumes the remote computer is running samba. The Python code would be something like: import logging, logging.handlers l

Re: [Tutor] Warehouse system in python

2006-06-20 Thread Python
On Tue, 2006-06-20 at 09:59 +0200, János Juhász wrote: > Dear All, > > have seen someone any simple warehouse management framework in python > with receive, issue, inventory ? I have not used it, so I don't know the scope of what they do, but tinyerp includes stock

Re: [Tutor] string formatting currency

2006-06-20 Thread Python
On Tue, 2006-06-20 at 13:49 -0400, Paul D. Kraus wrote: > How can i print a float as a currency with commas. > > 1222333.4 -> 1,222,333.40 > > if i '%0.2f'%number > > i get > 1222333.40 import locale >>> locale.setlocale(locale.LC_ALL,"") 'en_US.UTF-8' >>> currency_symbol = locale.localeconv()

Re: [Tutor] database help for newbie, fetchall()

2006-06-26 Thread Python
gt; at some point i need the results to end up as strings. The python sql module will have converted the data items into Python data types. That is usually preferable. If you really need all of your data as strings, your code could look something like: def strcols(cursor): for row i

Re: [Tutor] Python urllib (linux)

2006-06-30 Thread Python
On Fri, 2006-06-30 at 13:58 +, Patty wrote: > Hi all, > I'm doing some failure testing for a python script that uses urllib and > urllib2 > to open a web page and post data. If the server's apache is down or if I > change > the ip address the script is try

Re: [Tutor] Moved Python installation. Need advice rebuilding all *.pyc

2006-07-03 Thread Python
rebuilt as and when you next import those modules. > > Thanks for the info. However, if this is being done automatically on > import, why does "python setup.py install" often do some compilation ? There is a program called compileall.py. I'm on linux and do not know the d

Re: [Tutor] Two Newbile Questions: porting drawmap.c, & Python as a lifetime language

2006-07-05 Thread Python
On Tue, 2006-07-04 at 16:37 -0500, [EMAIL PROTECTED] wrote: > I am seeking opinions from seasoned veterans on the following two > questions: > You're getting plenty of replies. Here's a bit more. You're probably aware that ESRI has adopted Python for scripting with

Re: [Tutor] Logical Sorting

2006-07-07 Thread Python
gical sort on a > list like this, and sort it the way I want, or will I have to write my > own sorting function? There is an rpm-python package that probably includes much of what you want. I have it installed, but never used it. It appears to be pretty light on documentation. I expect

Re: [Tutor] loops to assign variables

2006-07-22 Thread Python
On Sat, 2006-07-22 at 14:11 +0100, John CORRY wrote: > Hi, > > I am refactoring my code. I am trying to reduce the amount of lines > by using more loops. I tend to use copy and paste a lot instead of > writing a loop to do the work. > > For example, I have 30 textentry boxes numbered from ent

Re: [Tutor] loops to assign variables

2006-07-22 Thread Python
On Sat, 2006-07-22 at 17:18 +0200, Karl Pflästerer wrote: > On 22 Jul 2006, [EMAIL PROTECTED] wrote: > > > > > On Sat, 2006-07-22 at 14:11 +0100, John CORRY wrote: > >> Hi, > >> > >> I am refactoring my code. I am trying to reduce the amount of lines > >> by using more loops. I tend to use cop

Re: [Tutor] Notes on namespaces, scopes, etc

2006-07-29 Thread Python
on't store values, they refer to values. Thinking > of variables as containers doesn't work in Python. What I told my kids (Dad, Do we really have to learn Python?) was that variables are sticky notes. The variable name is written on the note and stuck onto the object. a = 3 create

Re: [Tutor] question about type str

2006-07-29 Thread Python
On Sat, 2006-07-29 at 09:26 -0500, shawn bright wrote: > Hey there, > i have an app with this line. > sys.stderr.write("GET DATA %s %d %d\n" (sound, time_limit, digit_count)) sys.stderr.write("GET DATA %s %d %d\n" % (sound, time_limit, digit_count)) ^

Re: [Tutor] critique my script!

2006-08-03 Thread Python
(Sorry about accidental posting before I had finished editing.) On Thu, 2006-08-03 at 15:37 -0700, Christopher Spears wrote: > I rewrote my code with Alan's suggestions in mind. > > #!/usr/bin/python > > import os, os.path, glob > > def glob_files(pattern, base_pat

Re: [Tutor] critique my script!

2006-08-03 Thread Python
On Thu, 2006-08-03 at 15:37 -0700, Christopher Spears wrote: (in the os.walk processing) > os.chdir(path) > matched_files = glob.glob(pattern) >From the os.walk documentation Note: If you pass a relative pathname, don't change the current working dir

Re: [Tutor] critique my script!

2006-08-03 Thread Python
On Thu, 2006-08-03 at 15:37 -0700, Christopher Spears wrote: > I rewrote my code with Alan's suggestions in mind. > > #!/usr/bin/python > > import os, os.path, glob > > def glob_files(pattern, base_path = '.'): > abs_base = os.pat

Re: [Tutor] critique my script!

2006-08-03 Thread Python
On Fri, 2006-08-04 at 00:26 +0100, Alan Gauld wrote: > > Under the LearningToProgram directory is a test > > directory that doesn't contain any .pyc files, so the > > script's returned value is correct. However, .pyc > > files exist in the LearningToProgram directory, and I > > would like to put t

Re: [Tutor] creating a method name on the fly

2006-08-07 Thread Python
On Mon, 2006-08-07 at 18:10 +, dave s wrote: > I need to scan a long list of QT tickboxes in a dialog. I need to execute > pseudo code something like ... > > > list = ['error_button', 'print_button' ... etc ] > for key in list: > button= l

Re: [Tutor] How to teach Python

2006-08-12 Thread Python
On Sat, 2006-08-12 at 15:09 -0700, Elaine wrote: > I am going to be teaching "Introduction to Python > Programming" in the Fall at Foothill College in Los > Altos Hills, CA. This is a 5 quarter unit class for > students who already know one programming language. >

Re: [Tutor] python & mysql question

2006-09-07 Thread Python
On Thu, 2006-09-07 at 02:42 +, Patricia wrote: > Hi, > > I have to store and retrieve text files from a database table and > the size of each file is about 500k. Can someone give me an idea > on how to do this? > > Thanks, > Patricia http://dustman.net/andy

Re: [Tutor] Problems serving up PDF

2006-09-15 Thread Python
On Thu, 2006-09-14 at 18:01 -0800, Tim Johnson wrote: > * Luke Paireepinart <[EMAIL PROTECTED]> [060914 17:37]: > > > > > Sounds like it's working to me. > > > On Internet Explorer 6, Windows XP, the user experience is different. > > > IE ignores the file name, and does no progress reporting, bu

Re: [Tutor] Data structure question / PyGoogle

2006-09-16 Thread Python
On Sat, 2006-09-16 at 09:44 -0500, Brian Edward wrote: > Hello all, > > I am new to Python (and programming in general) and am trying to get > PyGoogle figured out for some specific research interests. Basically, > I have done a simple search using PyGoogle and have some sitting

Re: [Tutor] Data structure question / PyGoogle

2006-09-16 Thread Python
(forwarding to list) On Sat, 2006-09-16 at 10:31 -0500, Brian Edward wrote: > Thanks for the quick reply! I really appreciate your assistance. Of > course, it will take some time to get this worked out, but your > explanation is very clear. > > Best, > Brian > >

Re: [Tutor] Python CGI Script

2006-09-20 Thread Python
On Wed, 2006-09-20 at 15:46 -0600, Mike Hansen wrote: > > > -Original Message- > > Subject: Re: [Tutor] Python CGI Script > > > > >query1 = """SELECT ABC FROM %s limit %s,%s"""\ > > >

Re: [Tutor] Python CGI Script

2006-09-21 Thread Python
On Thu, 2006-09-21 at 08:38 -0600, Mike Hansen wrote: > > > -Original Message- > > From: Alan Gauld [mailto:[EMAIL PROTECTED] > > Sent: Thursday, September 21, 2006 2:51 AM > > To: Mike Hansen; tutor@python.org > > Subje

Re: [Tutor] looping problem

2006-09-23 Thread Python
On Sat, 2006-09-23 at 09:03 -0700, kumar s wrote: > hi, > > thank you. this is not a homework question. > > I have a very huge file of fasta sequence. > > > GeneName \t > AATTAAGGAA.. > > > > > > (1000 lines) > AATAAGGA > >GeneName \t > GGAG

Re: [Tutor] [Fwd: Re: from string to variable name]

2006-10-05 Thread Python
On Thu, 2006-10-05 at 09:17 -0500, Luke Paireepinart wrote: (actually from Frank) > > I have a parameterized string template, I publish it using > > > > print mytemplate % locals() Original post asked to create variable in local namespace from string. > so I want to assign a value to a variable w

Re: [Tutor] OT: Book(s) about linux

2006-10-05 Thread Python
On Thu, 2006-10-05 at 11:33 -0400, Bernard Lebel wrote: > Hello, > > Sorry to use this list for such an OT subject. But I want to get hands > down with Linux, and am looking for a book or two on the subject. > > I'm looking for information about installation, configuration, > optimisation, and ma

Re: [Tutor] Variable help

2006-10-08 Thread Python
the return value, you simply have to > assign it to a variable: > > result = choose_player(3) > > And then you can do whatever you want with result. Bear in mind that > result and player3[3] are *not* the same thing, they only have the same > value. (let me offer a correction

Re: [Tutor] SQL Queries For MySQL

2006-10-12 Thread Python
h the ist archives you'll find a fairly long thread > > describing the whys/wherefores in much more depth. > > > > HTH, > Since the archive is large - could you provide the subject title. http://www.google.com/search?hl=en&q=cursor.execute+tutor+python&btnG=Google+Sear

Re: [Tutor] SQL Queries For MySQL

2006-10-12 Thread Python
On Thu, 2006-10-12 at 14:46 -0700, johnf wrote: > On Thursday 12 October 2006 07:14, Jason Massey wrote: > > On 10/12/06, johnf <[EMAIL PROTECTED]> wrote: > > > On Thursday 12 October 2006 00:31, Alan Gauld wrote: > > > > > query = "SELECT * FROM DB WHERE NAME = %s" % (name) > > > > > cursor.execut

Re: [Tutor] Sharing data between modules

2006-10-19 Thread Python
On Thu, 2006-10-19 at 10:41 +0100, [EMAIL PROTECTED] wrote: > Hi > > just starting to get to grips with writing GUIs in Python using wxPython and > not being a computer scientist, have a philosophical question about the > "best" > way to pass data between vari

Re: [Tutor] property built-in

2006-10-19 Thread Python
On Thu, 2006-10-19 at 19:03 +0200, thomas wrote: > Hi, > > > I was wondering some things about property. > > suppose I have a class like this: > > class A(object): > def __init__(self, x, y): >self.__x = x > > def x(): >def get(self): fget > retur

Re: [Tutor] need some class / module help

2006-10-20 Thread Python
On Fri, 2006-10-20 at 13:44 -0500, shawn bright wrote: > if i name them, like bob = group.Group(some_id) ? > > what is going to happen is that each time, the variable will create a > different object > > like > while 1: > group = group.Group(some_id) > do some stuff with group. > > so

Re: [Tutor] sending mails from python

2006-10-21 Thread Python
On Sat, 2006-10-21 at 12:45 +0200, euoar wrote: > I'm trying to learn how to send e-mails with python. But I always become > this error: socket.error: (110, 'Connection timed out'). It sounds like you were unable to connect to the mail server. That could be due to a la

Re: [Tutor] numpy memory muncher

2006-11-13 Thread Python
print a[row,col] does not cause the memory usage to grow. I guess numpy needs to allocate some memory when binding a python variable to an array element. This memory does not appear to get released when the python variable is deleted or passes out of scope. The gc (garbage collector) mod

Re: [Tutor] how to extract time from datetime.date.time()

2006-11-16 Thread Python
On Thu, 2006-11-16 at 17:28 +, Asrarahmed Kadri wrote: > Hi, > > I want to extract hh:mm:ss from below mentioned code: > > import datetime > >>> t = datetime.datetime.now() > >>> print t > 2006-11-16 16:59:02.843000 > > How to do it? The p

Re: [Tutor] email content-type: text/plain

2006-11-16 Thread Python
is. Should i use > MIMEText(message, 'text/plain') ? NO. server.sendmail takes a list of recipients. So rather than specifying msg['To'] for the recipients, use [address,'[EMAIL PROTECTED]'] You'll see exactly what you are sending. My emails that get

Re: [Tutor] (no subject)

2006-11-25 Thread Python
On Sat, 2006-11-25 at 00:10 -0600, Luke Paireepinart wrote: > Although I'm prettty sure most modern linux distros come with Python > already installed, so you don't need to be concerned about those linux > folk. I think Windows is the only major OS distribution that still omit

Re: [Tutor] What are the issues in running Python script on another machine (developed on Windows but will be using on Linux)

2006-11-27 Thread Python
On Sun, 2006-11-26 at 15:14 +, Asrarahmed Kadri wrote: > > > Hi folks, > > I have a couple of programs that I want to test on a different > machine.. > > I have developed these on Win-XP platform, but I want to test them on > my college's machine, which is running Linux. > > Are there

Re: [Tutor] Python Linux Distro Anyone

2006-11-29 Thread Python
On Tue, 2006-11-28 at 22:45 -0500, Amadeo Bellotti wrote: > I was thinking it would be really nice if i could make a Pocket Linux > distro that of course fits on one or two floppies (outdated I no but > still are amazing) thats just the Linux kernel, bash, and python. with > of cou

Re: [Tutor] Best Known Method for Filtering redundant list items.

2006-11-30 Thread Python
On Thu, 2006-11-30 at 12:51 -0800, Chris Hengge wrote: > Anyone point me to something more efficient then > list2 = list(set(list1)) Older Pythons will force you to import sets and use sets.Set > for item in list1: > if item not in list2: >list2.append() > > This just seems to

Re: [Tutor] Best Known Method for Filtering redundant list items.

2006-11-30 Thread Python
Right after hitting send I realized I fail to preserver order. If preserving order is important, we're back to using more complex code. On Thu, 2006-11-30 at 16:01 -0500, Python wrote: > On Thu, 2006-11-30 at 12:51 -0800, Chris Hengge wrote: > > Anyone point me to something more

Re: [Tutor] Best Known Method for Filtering redundant list items.

2006-12-01 Thread Python
> > http://en.wikipedia.org/wiki/Set > > If you want a collection of ordered objects, you don't want a > set. Not > even if the current implementation of sets in Python did > preserve > order. Doing s

Re: [Tutor] ***SPAM*** List to dictionary

2006-12-07 Thread Python
On Thu, 2006-12-07 at 08:22 -0700, Mike Hansen wrote: > > > -Original Message- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] On Behalf Of Luke Paireepinart > > Sent: Wednesday, December 06, 2006 10:54 PM > > To: tutor@python.org > > Subject: Re: [Tutor] ***SPAM*** List to dic

Re: [Tutor] help

2006-12-09 Thread Python
On Sat, 2006-12-09 at 20:19 +0500, Kamran Haider wrote: > Hi > > I have got some python related queries. I am working on an MRes > project > which involves a bit of programing in python. Actually, I am using a > python program developed by someone, which gives pairwise genetic &

Re: [Tutor] Ftp files

2006-12-19 Thread Python
On Tue, 2006-12-19 at 07:11 -0800, ray sa wrote: > Hi > > I have just started to learn Python and think it is a superb language. > I am faced with an issue that I would like some help with. I need to > fetch files on a daliy basis from a unix machine. I would like to run > a

Re: [Tutor] Length of longest item in a list, using a list comp

2006-12-28 Thread Python
On Thu, 2006-12-28 at 11:27 -0800, Tony Cappellini wrote: > > > I want to use a list comp to get the length of the longest string in a > list, but can't quite get the syntax right. > > l1=['abc', 'abcde', 'abcfdtea'] > > longest=0 > [x for x in l1 if len(x) > longest] Use max to get the longe

Re: [Tutor] How to convert a long decimal into a string?

2007-01-16 Thread Python
On Tue, 2007-01-16 at 12:28 -0800, Dick Moores wrote: > So I go with working up "an algorithm for first > converting n to an int (for > example, multiplying the above n by 1000), converting to a string, > putting the decimal point back in between indices 2 and 3, then using > that string as n (the

Re: [Tutor] Perfect Python web stack?

2007-01-17 Thread Python
On Wed, 2007-01-17 at 16:46 +0200, OkaMthembo wrote: > > 1) MySQL vs PostGRES PostGRES is a more sophisticated SQL server. It should probably be the default choice. However, I'm primarily using MySQL. The reasons: easy administration - I think supporting dozens of remote databas

Re: [Tutor] Set changing order of items?

2007-01-19 Thread Python
On Fri, 2007-01-19 at 20:05 +, Adam Cripps wrote: > On 1/19/07, Simon Brunning <[EMAIL PROTECTED]> wrote: > > On 1/19/07, Adam Cripps <[EMAIL PROTECTED]> wrote: > > > I'm adding strings to a Set to prevent duplicates. However, the > > > strings are meant to be in the correct order. When I add t

Re: [Tutor] Redirect from a CGI script

2007-01-19 Thread Python
On Sat, 2007-01-20 at 02:10 +, Paulino wrote: > Thank you Andre, > > well it doesn't work either! This works, #!/usr/bin/python print "Location:http://python.org/\r\n\r"; as does this #!/usr/bin/python print "Content-type:text/html\r" print &

Re: [Tutor] Redirect from a CGI script

2007-01-20 Thread Python
only these two lines: > 'print "Content-type:text/html\r\n" > 'print "Location:http://python.org/\r\n\r"; > > I have a Win Xp pro machine with Python2.5. > > Paulino > > On Sat, 2007-01-20 at 02:10 +, Paulino wrote: > > &

Re: [Tutor] Redirect from a CGI script

2007-01-20 Thread Python
On Sat, 2007-01-20 at 10:13 -0800, Danny Yoo wrote: > > On Sat, 20 Jan 2007, Paulino wrote: > > > Still doesn't work. > > [some text cut] > > > I tryed all the sugestions from Andre with no succes. > > > > The cgi script as only these two lines: > > 'print "Content-type:text/html\r\n" > > '

Re: [Tutor] Accessing class attributes: use methods only?

2007-02-19 Thread Python
my.setx = 42 Alan is saying you should not generally be twiddling attributes in an object. Kent is suggesting that if you do decide to twiddle attributes in Python, just do it directly. If later on you decide you need some method logic to control the attribute twiddling, you can use p

[Tutor] Some questions.

2007-04-12 Thread python
Hello my name is lamonte and I'm interesting in getting better @ python so I guess this is the correct place then :). One question is whats the best GUI library to build from? Anyone recommend any good tutorials that helped them get good @ learning python? I know some decent basics and so

[Tutor] Best practice: Use % operator or locale.format?

2008-04-14 Thread python
Does the % operator always respect locale or should one use locale.format() instead? Are there guidelines where one should use one string formatting technique vs. another? Thanks! Malcolm ___ Tutor maillist - Tutor@python.org http://mail.python.org/ma

Re: [Tutor] Hoping to benefit from someone's experience...

2008-04-15 Thread python
Mark, Here's how we work with RTF: We create a Word document formatted exactly like we want with special markers (unique text) inserted in places where we want to programmatically add text. We save this document to RTF (this RTF becomes our template file), remove all the carriage returns and line

Re: [Tutor] Remove specific chars from a string

2008-04-16 Thread python
Ricardo, Thanks for the tip on how to use maketrans. I was trying to over-complicate things on my side. The string module lives in 3.0 ... only the duplicate methods have been removed. Regards, Malcolm ___ Tutor maillist - Tutor@python.org http://mai

[Tutor] Best practice for installing new packages (eggs)

2008-04-17 Thread python
there conventions for where to put core packages, experimental packages, and packages that one is building themselves? Also, is it safe to assume that installing a 3rd party package won't (unexpectedly) affect other parts of my Python environment. I'm running Python 2.5.2 on Windows XP Pro

[Tutor] When to use __new__ vs. __init__ ?

2008-04-18 Thread python
Any guidelines on when to use __new__ vs. __init__ when sub-classing? Thanks! Malcolm ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] When to use __new__ vs. __init__ ?

2008-04-18 Thread python
Thanks Kent! Malcolm ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Why next vs. __next__ ?

2008-04-21 Thread python
Is there a reason why generators have a special method named "next" vs. "__next__"? All other Python's special names have the double underscore prefix/suffix. http://docs.python.org/ref/specialnames.html Are there other special names like "next" that don't have the double underscore delimiters?

[Tutor] When to use % vs. locale.format()?

2008-04-21 Thread python
Are there any best practices guidelines that discuss when one should use % vs. locale.format? The locale.format() seems closer to the new new Python 3.0 print-as-a-function vs. statement ... with the added benefit of localized output. Malcolm ___ Tutor

Re: [Tutor] listing classes

2008-05-20 Thread python
Thomas, > import types > [ name for name in dir(A) if type(eval('A.'+name)) == types.ClassType ] The == types.ClassType doesn't seem to pick out the classes. Also, I think you should be returning eval( name ) vs. name so that the OP gets a list of objects vs. names? (My take on what the poster w

Re: [Tutor] I am a web designer wanting to learn Python

2008-05-28 Thread python
Wesley, Don't be so modest - your "Core Python Programming" (by Wesley Chun) is also a great book for those looking to learn Python. Malcolm ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] %T as a strftime format identifier

2010-11-27 Thread python
32-bit Python 2.7 for Windows: >>> import time >>> time.strftime("%T") Traceback (most recent call last): File "", line 1, in time.strftime("%T") ValueError: Invalid format string Malcolm ___ Tu

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

2010-12-16 Thread python
Joel, > One more question: IDLE does not appear to have a way to review your command > history, e.g., by hitting the up arrow. To move through your command history, use Alt+P (previous) and Alt+N (next). Malcolm ___ Tutor maillist - Tutor@python.org

Re: [Tutor] Choice of Python

2010-12-28 Thread python
Marc/Emile, If you're looking for a good hosting service that supports Python, I strongly recommend webfaction.com. I've worked with a lot of hosting companies and webfaction gets my highest endorsement: Great support, helpful user community, very flexible support for hosting Python ap

Re: [Tutor] Writing Python Script to read battery level

2011-01-17 Thread python
FT, > Is there a way to read the battery level using Python? Check out the following code snippet: Get info on power/battery status http://nullege.com/codes/show/src@jaraco.windows-1.6@jaraco@wind...@power.py/14/ctypes.wintypes.BOOL This code snippet requires the following 3rd party packa

Re: [Tutor] tkinter, create widgets during runtime?

2011-01-27 Thread python
Elwin, There is a dedicated Python Tkinter mailing list called tkinter-discuss. I would post your question to this mailing list - I've found them very helpful. Malcolm ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscri

Re: [Tutor] accessing another system's environment

2011-02-26 Thread python
Bill, Coming into this thread late: If you are working with Windows workstations, try posting your question on the Python Windows API mailing list. http://mail.python.org/mailman/listinfo/python-win32 You may be able to use WMI (via Python) to accomplish what you're trying to do. Ma

Re: [Tutor] Excited about python

2011-06-10 Thread python
> For a handy reference, you can't beat "Python Essential Reference" by David Beazley (along with the online documentation, of course!). I think this book is obligatory if you are going to be working with Python a lot. I own all four editions :) > But you wanted somethi

Re: [Tutor] decorators

2011-06-24 Thread python
Steven, > Here's my cheap introduction to decorators... Beautifully explained! Thank you, Malcolm (not the OP) ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] "Object designer" applications - are there any?

2011-08-05 Thread python
Stephen, You might check out the SQL management tools from Embarcadero. They may provide some of the conversion capabilities you are looking for. And they generate beautiful documentation. Perhaps you could wrap the features of this product with Python scripts to acheive your goals? Malcolm

[Tutor] Personal: Re: Tutor Digest, Vol 90, Issue 97

2011-08-29 Thread python
Hi Frank, Please don't unsubscribe. Book reviews are always welcome. Malcolm ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Python Saved the Day

2011-12-04 Thread python
an evaluation version of a commercial product ... which after several weeks of extensive testing (and hundreds of man hours) never produced the correct results. It amazes me what can done with simple Python scripts and a KISS attitude. Malcolm ___ Tutor

[Tutor] Handling Generator exceptions in Python 2.5

2009-06-19 Thread Joe Python
I have a generator as follows to do list calculations. *result = [(ListA[i] - ListB[i-1])/ListA[i] for i in range(len(ListA))]* The above generator, throws '*ZeroDivisionError*' exception if ListA[i] = 0. Is there a way to say 'Don't divide by ListA[i] if its equal to 0 (within that statement)'.

Re: [Tutor] Handling Generator exceptions in Python 2.5

2009-06-19 Thread Joe Python
int results > > Vince > > > On Fri, Jun 19, 2009 at 8:55 AM, Joe Python wrote: > >> I have a generator as follows to do list calculations. >> >> *result = [(ListA[i] - ListB[i-1])/ListA[i] for i in range(len(ListA))]* >> >> The above generator, throws

[Tutor] reading and processing xml files with python

2009-06-20 Thread python . list
Hi, I am a total python XML noob and wanted some clarification on using python with reading remote XML data. All examples I have found assumes the data is stored localy or have I misunderstood this? If I browse to: 'user:passw...@domain.com/external/xmlinterface.jsp?cid=xxx&am

Re: [Tutor] happy holidays!

2004-12-24 Thread python programming
I am new to the list and wanted to wish everyone happy holidays. On Fri, 24 Dec 2004 09:53:00 -0700, Jason Child <[EMAIL PROTECTED]> wrote: > Just wanted to extend warm feelings to all the list members! Have a safe > and happy season. > > -- > Jason Christopher Child > > Computer Network Servi

Re: [Tutor] What's the invalid synax? Error message and code supplied.

2005-07-30 Thread python-tutor
    I'd count the parenthesis on the prior line: option = int(raw_input('Option (1,2,3,4,5,6,9): ') while option != 9: Also when you notice that you are copying and pasting the same line over and over, it may be time to think about reorganizing the code a little bit (Once you have it working)

Re: [Tutor] How do I make a Python program keep repeating?

2005-07-30 Thread python-tutor
How does the user indicate that they are done with the program? One solution is to ask at the end of each iteration if they want to repeat. Psuedocode: keep_going=True while(keep_going) Run your program stuff keep_going = get_user_response("Do you want to run again?") --Todd On Saturd

Re: [Tutor] When I run this code, it just keeps repeating.

2005-07-30 Thread python-tutor
Looks like you are making some pretty good progress. The short answer to your question is that the menu & user input need to be inside the while loop. That way cal_opt has a chance to change value before it gets evaluated by the while loop again. Another comment - the global cal_opt is conside

Re: [Tutor] Now what do I do?(was Re: When I run this code, it just keeps repeating.)

2005-07-30 Thread python-tutor
You are almost there. Do you undestand why you are getting the output that you are getting? Pretend that you are the computer and walk through what happens when you enter 9 at the menu: while cal_opt != 9: menu() cal_opt = cal() # This is where you entered '9' so cal_opt

Re: [Tutor] Help with file I/O.

2005-07-30 Thread python-tutor
ent > through Josh Cogliani's Non-Programmer's Tutorial for Python, and I still > can't understand it. > > Thanks in advance, > Nathan Pinno ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Thanks to all!

2005-07-31 Thread python-tutor
Congratulations! So what are you going to try next? --Todd On Sunday 31 July 2005 06:27 pm, Nathan Pinno wrote: > The Giant Calculator is perfect also! > - Original Message - > From: Nathan Pinno > To: tutor@python.org > Sent: Sunday, July 31, 2005 3:34 PM > Subject: [Tutor] T

Re: [Tutor] What's the invaild syntax? Error message and relative code supplied.

2005-07-31 Thread python-tutor
Remember this problem from yesterday? Take a look at the line before the one you are getting the error on. And count the ('s and the )'s. --Todd On Sunday 31 July 2005 07:38 pm, Nathan Pinno wrote: > What the invalid syntax? Here is the error message: > SyntaxError: invalid syntax > File "D

Re: [Tutor] deck dealing program

2005-08-08 Thread python-tutor
Are you: a.) Having trouble with the code and looking for help? b.) Looking for suggestions on how to improve the code? c.) Offering the code as a demo for Nathan et al.? I was just doing stuff along the same lines and was having fun seeing the different approaches to the same problem. -

Re: [Tutor] Question About chdir()

2005-08-08 Thread python-tutor
8 August 2005 03:07 am, Don Parris wrote: > The book, "Programming Python", shows an example of os.chdir() on the > Windows platform, as follows: > > os.chdir(r'c:\temp') > > What's the 'r' for? It didn't

Re: [Tutor] Get information from a web page

2005-08-08 Thread python-tutor
Not sure exactly what you have going wrong without the code or the exact url you are using. Does something like: import urllib page = urllib.urlopen("http://slashdot.org/article.pl?sid=05/08/08/043236&tid=126";).read() print page give you the correct results? Is the problem specific to o

Re: [Tutor] What can I do with this code?

2005-08-10 Thread python-tutor
How about changing it into a math quiz program? You have the program output random problems ("What is 14 * 3 ?") And then you can output appropriate random insults, words of encouragement, or praise as appropriate until the user gets the answer right. Just be careful with division. You proba

Re: [Tutor] SSH commands in Python on Linux

2005-08-10 Thread python-tutor
Ignoring the python stuff for the moment In answer to Question 1., You want to use Public Key authentication...this will let you log in without a password.Google for SSH Public Key Authentication will give you several hits for the howto's One pretty good one was

<    1   2   3   >