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 omits Python. Except, I

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 python interpreter can be pretty helpful for this kind

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

2006-11-16 Thread Python
(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 sent with Python code pretty much like yours have the proper MIME tag

Re: [Tutor] numpy memory muncher

2006-11-13 Thread Python
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) module did

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 large number of network issues

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 since it

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 various modules. For example, I anticipate

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.execute(query) (snipped)

Re: [Tutor] Variable help

2006-10-08 Thread Python
[3] *do* reference the same thing. My preferred analogy is that names in Python are written on sticky notes and stuck on the objects they refer to. The name and the object are separate and distinct. So we take a sticky note labeled result and stick it on the *same* object that player3[3] refers

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 whos

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

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 GGAGAGAGATTAAGAA

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 Subject: Re: [Tutor] Python CGI Script sql_statement = INSERT

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\ % (self.tableid,self.rangeid1,self.rangeid2) Just as a note: please don't do

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 On 9/16/06, Python [EMAIL

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, but does

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/python/python-and-mysql Provides some

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. I have been teaching programming

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_path = '.'): abs_base

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.path.abspath(base_path) #path_list

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 those

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

2006-07-29 Thread Python
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 creates an int object with a value of 3 and slaps

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)) ^ You

Re: [Tutor] understanding __import__()

2006-07-26 Thread python-tutor
Sean Perry wrote: Ok, this may be slightly above tutor's level, but hey, never hurts to ask (-: __import__ is dark magic; generally those who venture into that realm would do well to read the C source for Python.. I'm guessing that '.' is not in your sys.path, so Python isn't finding

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 copy and paste a lot

Re: [Tutor] Logical Sorting

2006-07-07 Thread Python
-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 it is a python wrapper to a C library. You may find it easier to simply pick apart your data and sort the numbers numerically than

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 their applications. 1. What's

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

2006-07-03 Thread Python
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 default Windows location. cd E:\Python24\site-packages

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 trying to contact to be a bogus address

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

2006-06-26 Thread Python
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 in cursor.fetchall

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 management. http

Re: [Tutor] Writing to a remote file

2006-06-19 Thread Python
. 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 logger = logging.getLogger

Re: [Tutor] I Give Up.

2006-06-17 Thread Python
. 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 modules, etc, so I looked up ConfigParser

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 , and able

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 immutable and can not be changed

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. # It is empty. Why?

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 no idea how to access a remote

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

2006-06-11 Thread Python
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 connect to the remote machine. I

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 a name binding. Assignment creates

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 import time import math class LinePuzzlePiece

Re: [Tutor] cisco router + telnetlib

2006-05-24 Thread Python
On Wed, 2006-05-24 at 18:18 -0400, Daniel McQuay wrote: Hello List, I am rather new to programming and I was wondering y'all think the best way to configure a cisco router using python would be. currently I am using telnetlib. my problem is, I get an error after connecting to the router

Re: [Tutor] problem with class - get message that self is not defined

2006-05-22 Thread Python
On Mon, 2006-05-22 at 14:28 -0400, Andrew Robert wrote: When I try to use the class listed below, I get the statement that self is not defined. test=TriggerMessage(data) var = test.decode(self.qname) Perhaps var = test.decode() would do what

Re: [Tutor] problem with class - get message that self is not defined

2006-05-22 Thread Python
to the top of the script and imported once Hopefully this helps. What I need is to get those values out. How to do that, I am not exactly clear. Andy Python wrote: On Mon, 2006-05-22 at 14:28 -0400, Andrew Robert wrote: When I try to use the class listed below, I get the statement

Re: [Tutor] Sending e-mail msg

2006-05-17 Thread Python
is: Message = From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] This is a test message Message length is 89 Traceback (most recent call last): File J:/SPSS/Python/EMailExample.py, line 14, in -toplevel- server = smtplib.SMTP('mail.hennepinPublicHealth.org') File C:\Program

Re: [Tutor] web intefaces?

2006-05-09 Thread Python
http://www.cherrypy.org Which is an app server that should be fairly easy to package up with, say py2exe. http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/442481 This is an example of configuring a cherrypy application so that it runs and starts the browser. It's a convenient way to make

Re: [Tutor] counting number of inputs

2006-05-03 Thread Python
BASIC, you could stick in tests sort of like: if number1 == -1 goto done: BUT Python does not have a goto. So we actually need some flow control around the block of code where you collect inputs. while blocks process an indefinite number of times while a test condition is True. for blocks

Re: [Tutor] counting number of inputs (EARLIER VERSION SENT ACCIDENTLY)

2006-05-03 Thread Python
BASIC, you could stick in tests sort of like: if number1 == -1 goto done: BUT Python does not have a goto. So we actually need some flow control around the block of code where you collect inputs. while blocks process an indefinite number of times while a test condition is True. for blocks

Re: [Tutor] Bitten by lexical closures

2006-05-03 Thread Python
On Wed, 2006-05-03 at 14:00 +0200, Igor wrote: Hi. And I thought I understood python pretty well. Until I got hit by this: def f(x): ... print x cb = [lambda :f(what) for what in 1234] for c in cb:c() 4 4 4 4 cb = [(lambda x=what:f(x)) for what in 1234] cb[0]() 1

Re: [Tutor] counting number of inputs (EARLIER VERSION SENT ACCIDENTLY)

2006-05-03 Thread Python
features in Python is the else clause that goes with the for and while blocks. The else block is executed when there is no break. So the skeleton for your program can look something like for x in range(5): # get inputs and break on -1 else: # no break so just process the inputs Good

Re: [Tutor] counting number of inputs

2006-05-02 Thread Python
to get input from the user? Do you know how to count things in Python? Do you know how to test a number to see if it is positive or negative? Why don't you post your code for any part of this problem and explain how it is supposed to work and where you are having difficulty. If necessary, review some

Re: [Tutor] looking to hire a tutor

2006-04-22 Thread Python
On Fri, 2006-04-21 at 19:44 -0700, [EMAIL PROTECTED] wrote: How would I go about hiring a python tutor who: Spends time critiquing my code and providing detailed feedback. Cares about good programming practices and is able to provide cogent explanations of programming principles. Can

Re: [Tutor] Splitting a number into even- and odd- numbered digits

2006-04-20 Thread Python
On Wed, 2006-04-19 at 17:17 -0700, Carroll, Barry wrote: Greetings: I am writing a function that accepts a string of decimal digits, calculates a checksum and returns it as a single character string. The first step in the calculation is to split the input into two strings: the even- and

Re: [Tutor] checking diagonals on a chessboard

2006-04-13 Thread Python
to you. They counted 30 diagonals, so if you come up with a different count, you either have an original approach or have blundered somewhere. (Hopefully that was the kind of pointer you were looking for. Tim Peters (I think) has written about this problem in a Python context, but citing Icon

Re: [Tutor] failing to learn python

2006-04-11 Thread Python
On Tue, 2006-04-11 at 12:06 -0400, Payal Rathod wrote: The reason I am disgrunted with Python is because lack of good documentation. http://www.python.org/doc/ The Python Docs - possibly you missed this because of the plethora of links. The Library Reference used to have the tag line

Re: [Tutor] Question about large numbers of arguments

2006-04-05 Thread Python
On Wed, 2006-04-05 at 12:34 +0100, Alan Gauld wrote: Suppose you have a situation where you have a large number of command-line options that you will parse with getopt. You want to keep track of these as you move around in the code and do various things. Is it more Pythonic to: Have

Re: [Tutor] date conversion

2006-04-05 Thread Python
On Wed, 2006-04-05 at 10:50 -0400, Kent Johnson wrote: Ray Allen wrote: I would like Python to convert a date returned by MySQL (2006-04-05) Kent's advice below is of course correct, but I'd bet your variable is already a datetime.date (or mx.DateTime.Date with older Python releases

Re: [Tutor] Python MP3

2006-03-21 Thread Python
On Tue, 2006-03-21 at 10:50 +0100, Johanna wrote: Hallo This is my first post, so hallo to everyone. Im just a newbee with python so I hope my msg will make some sense. J Is it possible to work with MP3 in python? yumex lists python-eyed3 python-mad as python

Re: [Tutor] Print list vs telnetlib.telnet.write differences

2006-03-06 Thread Python
On Tue, 2006-03-07 at 11:31 +1000, STREET Gideon (SPARQ) wrote: Enter configuration commands, one per line. End with CNTL/Z. switch01(config)#banner exec ^ ## switch01 Level XX, XX Some Street, Somewhere

Re: [Tutor] Print list vs telnetlib.telnet.write differences

2006-03-06 Thread Python
is often done with expect and I believe that there is some expect-like module for Python. As I suggested earlier, getting tftp to send command files will make a much better long term solution. This script would only have to manage logging in and starting tftp. Once that works all other commands

Re: [Tutor] problems with the shebang line and linux

2006-02-16 Thread Python
is the yum GUI, I do not remember the name of the apt GUI). On a shared partition, keeping .py files in a posix format (LF only) has never caused any problems for me. The Python compiler/interpreter on Windows will happily process either format. -- Lloyd Kvam Venix Corp

Re: [Tutor] Postgresql+Python -tutorial?

2006-02-11 Thread Python
On Sat, 2006-02-11 at 16:19 +1000, Joal Heagney wrote: I'm curious. Why? Is there some advantage to Postgres over MySql? Yes and no. Postgresql offers more features and is IMO more flexible than most SQL servers out there. A friend described MySQL as the RDBMS for people who do not

Re: [Tutor] smtplib with yahoo smtp server

2006-02-01 Thread Python
: by 10.65.100.11 with HTTP; Wed, 1 Feb 2006 05:21:36 -0800 (PST) Message-ID: [EMAIL PROTECTED] Intercodes, you are using a web interface to send your email. Can you get a normal (Evolution, Thunderbird, pine, etc.) email client to work on your system. If those do not work, your Python program

Re: [Tutor] email-sending.. (fwd)

2006-01-30 Thread Python
On Sun, 2006-01-29 at 10:09 -0800, Danny Yoo wrote (forwarding a direct reply to the list): Hi Danny, i have crossed that point where it complains of socket error.., but now i am stuck with another issue, where it says that it has sent the mail, but i dont recive any in my yahoo mail.,i have

Re: [Tutor] Searching for email id in MySQL giving wrong results

2006-01-23 Thread Python
On Sun, 2006-01-22 at 21:23 +0300, ZIYAD A. M. AL-BATLY wrote: wrong_string = '''SELECT s FROM t WHERE id=%s''' , (email_id) The string is being used in a call to cursor.execute. The email_id is a second parameter getting passed to execute. That is the *correct* approach to use. That

Re: [Tutor] Searching for email id in MySQL giving wrong results

2006-01-23 Thread Python
On Mon, 2006-01-23 at 18:17 +, Alan Gauld wrote: On Sun, 2006-01-22 at 21:23 +0300, ZIYAD A. M. AL-BATLY wrote: wrong_string = '''SELECT s FROM t WHERE id=%s''' , (email_id) The string is being used in a call to cursor.execute. The email_id is a second parameter getting

Re: [Tutor] Searching for email id in MySQL giving wrong results

2006-01-23 Thread Python
quoting issues for feeding the data to the database. I should have included the original code as I did here. Sorry if I created any confusion as related to regular Python string substitution. It is a very common mistake for people to do the SQL string interpolation themselves as opposed

Re: [Tutor] Searching for email id in MySQL giving wrong results

2006-01-23 Thread Python
in the execute call and posting what was on its face an invalid piece of Python coding. -- Lloyd Kvam Venix Corp ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Is this overkill?

2006-01-21 Thread Python
On Sat, 2006-01-21 at 10:09 -0500, Bradly McConnell wrote: On 1/21/06, Alan Gauld [EMAIL PROTECTED] wrote: number = input(Please enter a number: ) while number != 100: additional_number = input(Please enter an additional number: ) if additional_number + number 100:

Re: [Tutor] Quoting trouble

2006-01-20 Thread Python
name looks pretty ugly. I would recommend writing a function to replace that operation with an understandable function name (perhaps key2name). That would result in: setattr(self, key2name(key), val) Hope this helps. The ease with which Python allows you to attach names to values is one

Re: [Tutor] getting text within an element [attribute text] using elementtree

2006-01-19 Thread ps python
Dear group, In my XML file some attributes have text within an element. I want to get that text. How can I do that. I looked into ElementTree -bits and pieces: and there is a small function. def gettext(elem): ... text = elem.text or ... for e in elem: ... text +=

Re: [Tutor] Open file error

2006-01-17 Thread Python
and there, just to guess how python does the file search, but it keeps giving me 'No such file or directory'. i also tried variation of the file location string, but gave me a variation of errors :). Any suggestions? Furthermore, how does Python assumes the search path? Will it look at /LIB

Re: [Tutor] Open file error

2006-01-17 Thread Python
, a raw string is the same as any other Python string. When Python displays a raw string, Python will show the backslashes as \\ (doubled) because that is usually how you need to enter a backslash. Python does not track (as far as I know) that the string originated as a raw string. In regular strings

Re: [Tutor] Design suggestion - is a cookie the answer?

2006-01-16 Thread Python
On Mon, 2006-01-16 at 01:12 +, Alan Gauld wrote: I'm sure this is implied in Alan's post, but I'm going to point it out ... To avoid further cheating you might want to sure there is no way to submit the form without javascript turned on. E.g. Don't have a submit button and a form

Re: [Tutor] Multi-Dimensional Dictionary that contains a 12 element list.

2005-12-31 Thread Python
On Sat, 2005-12-31 at 09:33 -0500, Kent Johnson wrote: Could be self.results[key] = [0*24] [0]*24 Excellent points and advice, just noting a typo. -- Lloyd Kvam Venix Corp ___ Tutor maillist - Tutor@python.org

Re: [Tutor] assert

2005-12-23 Thread python-tutor
Try this: a=myClass() b=myClass() a.howmany() a.count=0 del a Does this help clear things up? Todd Maynard On Friday 23 December 2005 06:18, shivayogi kumbar wrote: class myClass:                         count = 0                          def __init__(self):                                

Re: [Tutor] assert

2005-12-23 Thread python-tutor
Shivayogi, Sorry my last e-mail wasn't very helpful. Better would have been: a=myClass() b=myClass() a.howmany() myClass.count=0 del a which will (hopefully) give you something like: Exception exceptions.AssertionError: exceptions.AssertionError instance at 0xb7b1d12c in bound

Re: [Tutor] how to extract text by specifying an element using ElementTree

2005-12-20 Thread ps python
is. Apologies if i am completely ignoring somethings. PS: Attached is the XML file that I am using. --- Kent Johnson [EMAIL PROTECTED] wrote: ps python wrote: Kent and Dany, Thanks for your replies. Here fromstring() assuming that the input is in a kind of text format. Right

Re: [Tutor] how to extract text by specifying an element using ElementTree

2005-12-20 Thread ps python
Dear drs. Yoo and johnson, Thank you very much for your help. I successully parsed my GO annotation from all 16,000 files. thanks again for your kind help --- Danny Yoo [EMAIL PROTECTED] wrote: for m in mydata.findall('//functions'): print m.get('molecular_class').text for m

[Tutor] writing list elements into a string

2005-12-15 Thread ps python
hi, can any one pls. help me on this simple issue. I keep forgetting some simple things and they turn out to be very important later. i have a list 'a', and now i want to write all the elements back in to a string. 'apple is a good fruit' - getting this back into a string has drained my

[Tutor] writing list elements into a string

2005-12-15 Thread ps python
-Repost. considering that my previous email lost - hi, can any one pls. help me on this simple issue. I keep forgetting some simple things and they turn out to be very important later. i have a list 'a', and now i want to write all the elements back in to a string. 'apple is a good

Re: [Tutor] lowercase, uppercase

2005-12-10 Thread Python
of Python, there is no need to use the string module. the upper and lower methods now built into str and unicode objects. -- Lloyd Kvam Venix Corp ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] how to extract text by specifying an element using ElementTree

2005-12-08 Thread ps python
Hi, using ElementTree, how can I extract text of a particular element, or a child node. For example: biological_processess biological_process Signal transduction /biological_process biological_process

[Tutor] how to extract text by specifying an element using ElementTree

2005-12-08 Thread ps python
Hi, using ElementTree, how can I extract text of a particular element, or a child node. For example: biological_processess biological_process Signal transduction /biological_process biological_process Energy process /biological_process /biological_processess

[Tutor] regular expressions

2005-12-07 Thread ps python
hi, I am a new python learner. i am trying to parse a file using regular expressions. LOCUS NM_005417 4145 bpmRNA linear PRI 04-DEC-2005 DEFINITION Homo sapiens v-src sarcoma (Schmidt-Ruppin A-2) viral oncogene homolog (avian) (SRC), transcript

Re: [Tutor] regular expressions

2005-12-07 Thread ps python
sorry for repost. awaiting to hear from some members. a scientist suggested me to try biopython. This point is not just with genbank sequences. what will i do if i have to parse a paragraph for some expression. thanks again. hi, I am a new python learner. i am trying to parse a file using

Re: [Tutor] Auto package install?

2005-12-06 Thread python-tutor
Maynard On Tuesday 06 December 2005 12:16, Nelson, Scott wrote: The Zen of Python (http://www.python.org/doc/Humor.html#zen) states: There should be one-- and preferably only one --obvious way to do it. I'm searching for the obvious Pythonic way to achieve automated package installation

Re: [Tutor] smtplib problems ?

2005-11-21 Thread Python
On Mon, 2005-11-21 at 19:59 +, dave wrote: Traceback (most recent call last): File /home/dave/my files/andrew_torture/email_remind.py, line 49, in ? email_remind() File /home/dave/my files/andrew_torture/email_remind.py, line 43, in email_remind raise 'Mail

Re: [Tutor] Dynamic inheritance?

2005-11-19 Thread Python
On Sat, 2005-11-19 at 16:45 +0100, Jan Eden wrote: Is there a way to dynamically determine the value of Super at runtime? Background: Depending on certain object attributes which are set during the object initialization, I need to use a different set of templates for the respective

Re: [Tutor] Dynamic inheritance?

2005-11-19 Thread Python
On Sat, 2005-11-19 at 15:23 -0800, Danny Yoo wrote: Here's a small example that shows how classes can be treated just like any other value in Python: # def makeYa(superclass): class Ya(superclass): def sayHi(self

Re: [Tutor] question about serial coms

2005-11-15 Thread Python
The device at the far end of the serial connection is echoing what you write back to you. This is a convenience for someone typing at a terminal, but a nuisance when you are programming. The easier way out is to turn echoing off at the far device. Failing that, you will want to provide a copy

[Tutor] [Fwd: Re: question about serial coms]

2005-11-15 Thread Python
... It's the simple stuff that will get ya! :) -Joe --- Python [EMAIL PROTECTED] wrote: The device at the far end of the serial connection is echoing what you write back to you. This is a convenience for someone typing at a terminal, but a nuisance when you are programming. The easier way out

Re: [Tutor] question about ord

2005-11-15 Thread Python
chr(value) chr(ord('a')) == 'a' True On Tue, 2005-11-15 at 14:46 -0600, nephish wrote: Hey there, i am using a script to change a byte into an integer like this: a = the byte value = ord(a) but i cant find the operation that can change it back to a byte. i am sure its

[Tutor] Using CGIHTTPServer on Windows to run Perl Python scripts - POST to Perl fails

2005-11-11 Thread Python
The perl scripts use cgi.pm. The Python scripts use the cgi module. Everything runs OK on Linux, where fork is available. On Windows the run_cgi method uses os.popen3 to run the script and writes the post data to the script's input file. The Python scripts are OK. The Perl scripts do

[Tutor] subclass problem: __names and type-checking

2005-10-08 Thread Python
Traceback (most recent call last): File C:/Python24/foofoofoo.py, line 26, in -toplevel- s2 = Sub2() File C:/Python24/foofoofoo.py, line 22, in __init__ super(Sub2, self).__init__() File C:/Python24/foofoofoo.py, line 10, in __init__ if type(self) == __TwoUnderBase: # What

[Tutor] Listing all of an instances variables

2005-10-08 Thread Python
def report(self): for i in dir(self): # use the getattr function print getattr(self, i) -- Lloyd Kvam Venix Corp ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] MySQLdb error - PLEASE SAVE ME!

2005-09-17 Thread Python
with the Python string format (%) operator. This should work so long as the name and URL never contain commas. -- Lloyd Kvam Venix Corp ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] MySQLdb error - PLEASE SAVE ME

2005-09-17 Thread Python
I dont see why your new code shouldn't work, it makes sense to me ... Danny nailed this one. He warned that your data could be short commas. You have lines with fewer than two commas. The INSERT is failing with: not enough arguments Simple fix is to skip insert if len(links) != 3.

[Tutor] Counting help

2005-08-23 Thread Python
, nameofsender[0]) If you are using a version of Python that supports sets, using sets would be much simpler since the duplicates get discarded automatically. import sets # python2.3 setofnames = sets.Set() while. setofnames.add(nameofsender[0]) len(setofnames) # count

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

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 http

<    1   2   3   >