Re: [Tutor] Cmd Advice

2012-02-11 Thread Dave Angel
On 02/11/2012 06:46 AM, Dave Hanson wrote: On Sat, Feb 11, 2012 at 11:35 AM, Dave Angel wrote: (Please don't top-post. Please put your comments after whatever parts you're quoting (replying to) ) Apologies Dave. You need to learn how to create a DOS window (or cmd window, ju

Re: [Tutor] Cmd Advice

2012-02-11 Thread Dave Angel
On 02/11/2012 07:14 AM, Dave Angel wrote: On 02/11/2012 06:46 AM, Dave Hanson wrote: On Sat, Feb 11, 2012 at 11:35 AM, Dave Angel wrote: (Please don't top-post. Please put your comments after whatever parts you're quoting (replying to) ) Apologies Dave. You need to learn how t

Re: [Tutor] Cmd Advice

2012-02-11 Thread Dave Hanson
On Sat, Feb 11, 2012 at 12:43 PM, Dave Angel wrote: > On 02/11/2012 07:14 AM, Dave Angel wrote: > >> On 02/11/2012 06:46 AM, Dave Hanson wrote: >> >>> On Sat, Feb 11, 2012 at 11:35 AM, Dave Angel wrote: >>> >>> (Please don't top-post. Please

Re: [Tutor] Cmd Advice

2012-02-11 Thread Dave Angel
On 02/11/2012 07:53 AM, Dave Hanson wrote: I did try with pause during my previous attempts to get the .bat file running and when it ran with no errors I tried the pause again, pressed Enter and the window just closes and nothing happens. Cmd.exe does still exist, it's just that when yo

Re: [Tutor] Learn Python The Hard Way, Ex19-3

2012-02-11 Thread Dave Angel
On 02/11/2012 05:26 PM, amt wrote: Hello! I'm currently stuck at the Extra Credit 3 from LPTHW. Link to the actual exercise:http://learnpythonthehardway.org/book/ex19.html The exercise: Write at least one more function of your own design, and run it 10 different ways. Code from the book: def c

Re: [Tutor] repeat a sequence in range

2012-02-11 Thread Dave Angel
On 02/11/2012 06:22 PM, Michael Lewis wrote: I am trying to repeat a certain sequence in a range if a certain even occurs. Forgive me for not pasting my code; but I am not at the machine where it's saved. Basically, I want to get user input and append that input to a list only if the input is no

Re: [Tutor] Running Files with Command Lines

2012-02-11 Thread Dave Angel
On 02/12/2012 02:24 AM, Yony Torres wrote: Hello buddies I'm trying to learn Python from a well known book, and i'm stuck with something that i know that might seem surprisingly easy for you and i would like to humbly request your help: i created a script in a file named script1.py and i saved

Re: [Tutor] string integers?

2012-02-12 Thread Dave Angel
On 02/12/2012 08:25 AM, William Stewart wrote: I am trying to get 2 string variables and 2 integer variables to be able to be multiplied can anyone tell me what I did wrong str1 = raw_input("Type in a String: ") str2 = raw_input("Type in a String: ") int1 = raw_input("Type in a integer varia

Re: [Tutor] Same code has different result

2012-02-12 Thread Dave Angel
On 02/12/2012 12:02 PM, Andreas Perstinger wrote: [You've forgot to include the list in your reply] On Mon, 13 Feb 2012 00:04:54 +0800 daedae11 wrote: Sorry, I'm not sure I know your viewpoint. Could you give me a detailed explanation about "you need more than about 6-7 seconds (on my compute

Re: [Tutor] Running Files with Command Lines

2012-02-12 Thread Dave Angel
On 02/12/2012 11:57 AM, Yony Torres wrote: 1. i tried this morning and it worked in the CMD check it out: copied and pasted from the CMD C:\Users\myusername>cd documents C:\Users\myusername\Documents>cd varios2 C:\Users\myusername\Documents\varios2>cd pythonjourney C:\Users\myusername\Documents\

Re: [Tutor] Cmd Advice

2012-02-13 Thread Dave Hanson
On Sat, Feb 11, 2012 at 2:03 PM, Walter Prins wrote: > Hi all, > > Below is an *earlier* (note the date) private response by myself that > at the time accidentally didn't get sent to the list and only to Dave > (as he privately replied to me only and not to the list.) Given

Re: [Tutor] How to convert seconds to hh:mm:ss format

2012-02-16 Thread Dave Angel
On 02/16/2012 04:46 PM, alain Delon wrote: userName = raw_input("Enter your name ") print "hi " + userName + ". \n " seconds = input("Enter the number of seconds since midnight:") hours = seconds/3600 hoursRemain = hours%60 minutes = hoursReamain/60 secondsRema

Re: [Tutor] dict vs several variables?

2012-02-17 Thread Dave Angel
On 2/17/12, Peter Otten<__pete...@web.de> wrote: Leam Hall wrote: I'm building a program that uses one of my own modules for a bunch of formula defs and another module for the tkinter GUI stuff. There are half a dozen input variables and about the same in calculated variables. Is it better/c

Re: [Tutor] dict vs several variables?

2012-02-17 Thread Dave Angel
On 02/17/2012 09:06 AM, leam hall wrote: On 2/17/12, Dave Angel wrote: Real question is whether some (seldom all) of those variables are in fact part of a larger concept. If so, it makes sense to define a class for them, and pass around objects of that class. Notice it's not global,

Re: [Tutor] arrays, while loops

2012-02-18 Thread Dave Angel
On 02/18/2012 01:35 PM, Deborah Knoll wrote: Hi I need some help with my program. I need to: First thing you need to do when asking a question is to establish what version of Python you're running, and on what OS . In this case OS probably doesn't matter, but version does. Mark Lawrence assu

Re: [Tutor] arrays, while loops

2012-02-19 Thread Dave Angel
On 02/19/2012 07:01 PM, Deborah Knoll wrote: Hi You forgot to include the list in your reply, so your message came only to me. That's not the way to keep a discussion going, for several reasons. Normally, you should just do a Reply-All to messages to add to the thread. or you can make su

Re: [Tutor] arrays, while loops

2012-02-20 Thread Dave Angel
I'm not sure who you are, but you forgot to include the list. Therefore I'll forward this to the list, and add my comments about your suggestions. On 02/20/2012 11:31 AM, Ricardo Araoz wrote: El 20/02/12 00:00, Dave Angel escribió: On 02/19/2012 07:01 PM, Deborah Knoll wrote: A

Re: [Tutor] What made Python differ from other Languages?

2012-02-20 Thread Dave Angel
On 02/20/2012 11:43 AM, Sunil Tech wrote: *I am Beginner (very little i know), i want to know what are new things i can find in Python.* There are thousands of computer languages out there. Nearly every feature has an analog out there somewhere. So "what's new" really depends on what lang

Re: [Tutor] What made Python differ from other Languages?

2012-02-20 Thread Dave Angel
On 02/20/2012 12:16 PM, Darin Lawson Hosking wrote: Sunil Here is great way to get started on Python, even though the first few videos are setting up a Linux virtual machine to develop within, he quickly moves onto Python. http://www.youtube.com/user/RaspberryPiTutorials/videos Darin The ab

Re: [Tutor] __name__=='__main__'

2012-02-20 Thread Dave Angel
On 02/20/2012 06:46 PM, Michael Lewis wrote: Hi everyone, I am having some trouble understanding how to use __name__== '__main__'. Can you please give me some insight? Also, to use this, it needs to be within a function? Do you typically just throw it in your very last function or create a separ

Re: [Tutor] __name__=='__main__'

2012-02-20 Thread Dave Angel
On 02/20/2012 10:07 PM, Michael Lewis wrote: Now that I am better understanding '__name__'=='__main__', I need to get advice on one last part. Since you put this in the file as an if statement, some instruction must come after. What do you suggest putting after this statement/is that piece of cod

Re: [Tutor] '__name__' == '__main__'

2012-02-20 Thread Dave Angel
On 02/20/2012 11:55 PM, Michael Lewis wrote: I am back to being confused. I just tried running the module without first importing it, and it worked just fine. How do I do this properly to where the module only runs if I import it? I'd still like a definition of "just fine." But anyway, your fir

Re: [Tutor] Checking for file completion.

2012-02-21 Thread Dave Angel
On 02/21/2012 01:10 PM, Tony Pelletier wrote: Hi, I'm struggling with what I think seems to be a problem. I've created a program that does numerous SOAP calls. In short, I create a report on a report server, pull that file down then parse that file that's been written locally for data to make

Re: [Tutor] Checking for file completion.

2012-02-21 Thread Dave Angel
On 02/21/2012 01:42 PM, Tony Pelletier wrote: Please post your message again, as a text message rather than an html one. Reading non-trivial python code that's lost all its indentation is impossible. You've done it before, but that case was simple enough to not matter much. -- DaveA Sor

Re: [Tutor] Checking for file completion.

2012-02-21 Thread Dave Angel
On 02/21/2012 05:20 PM, Tony Pelletier wrote: def getReport(service, reportId): reportIds = service.client.factory.create('ArrayOfstring') reportIds.string.append(reportId) try: result = service.client.service.ReportQueryById(reportIds, 'True')

Re: [Tutor] how to rewrite area.py

2012-02-21 Thread Dave Angel
On 02/21/2012 06:51 PM, William Stewart wrote: hello I need to rewrite area.py program so that it has separate functions for the perimeter and area of a square, a rectangle, and a circle (3.14 * radius**2). I am horrible at math and I cannot even figure out what I need to do for this Any help wo

Re: [Tutor] Python assginment

2012-02-21 Thread Dave Angel
On 02/21/2012 07:40 PM, Sukhpreet Sdhu wrote: hi i m working on Python assignment to convert roman numericals to arabic and vice versa.I had tried many different codes but those are not working. Can you please suggest me the code to do this by using while , if and else statements. thanks Sukhpr

Re: [Tutor] Recognizing real numbers

2012-02-22 Thread Dave Angel
On 02/21/2012 10:00 PM, Michael Lewis wrote: Hi everyone, I have some code where I import a file to use a module. That module that I import takes text and a multiplier, checks for any numbers in that text and will then multiply those numbers by the given multiplier. The imported module is below.

Re: [Tutor] Recognizing real numbers

2012-02-22 Thread Dave Angel
On 02/22/2012 08:54 PM, Michael Lewis wrote: On Wed, Feb 22, 2012 at 2:52 PM, Dave Angel wrote: I actually have a function written in my imported file to check if a string is a valid float, but I didn't use it because I also have raw_input in that same function, which I don't

Re: [Tutor] Which computer operating system is best for Python developers?

2012-02-23 Thread Dave Angel
On 02/23/2012 10:23 AM, Jugurtha Hadjar wrote: One last point: Having two versions of Python, here's what I did in order to chose which version is used depending what I'm doing (If I'm tinkering with Numpy, I must use Python26) Python 2.6 is installed in C:\Python26 Python 3.2 is installed

Re: [Tutor] Attribute error message received on Card Game program

2012-02-24 Thread Dave Angel
On 02/24/2012 11:34 AM, bob gailer wrote: On 2/24/2012 11:08 AM, SKHUMBUZO ZIKHALI wrote: Hi /*I am trying to run the following program from Guide to Programming with Python by Micheal Dawson:*/ /**/ class Card(object): RANK = ["A","2","3","4","5","6","7" "8","9","K","Q","J"]

Re: [Tutor] problem editing modules and defs

2012-02-24 Thread Dave Angel
On 02/24/2012 11:11 AM, David Craig wrote: Hi, I am new to python and have made a couple of definitions. I imported them and they worked ok. I they worked except for one which gave me the error "NameError: global name 'np' is not defined". I then edited my script for the def to include "import

Re: [Tutor] Staticmethod & Classmethod Question

2012-02-25 Thread Dave Angel
On 02/25/2012 03:31 AM, Chris Kavanagh wrote: Hey Everyone, I came across this code in 'A Byte Of Python' & realized there was a line I didn't understand. The line is "howMany = staticmethod(howMany)" (Complete code pasted below.) I don't think, in my very short Python career, I've h

Re: [Tutor] how to stop a program in python which is running for long time

2012-02-29 Thread Dave Angel
On 02/29/2012 09:33 AM, Debashish Saha wrote: Press the little X in the corner of the GUI ? Windows, Linux, or other? Console app running in the foreground, or a background app or gui? In Linux, you can either do a Ctrl-C or Ctrl-\ if the process is running in a terminal window, or a com

Re: [Tutor] Creating a Polyline Feature class

2012-03-03 Thread Dave Angel
I see Bob Gailer has responded to your message while I was still trying to make sense of it. His "guesses" are probably right on. I have no knowledge of arcpy, so I can't directly answer your query. But I may be able to help you formulate a question that will solicit some answers. On 03/0

Re: [Tutor] Simple GUI

2012-03-04 Thread Dave Angel
On 03/04/2012 06:59 AM, myles broomes wrote: Im trying to code a simple GUI but I'm having a bit of a problem. Heres my code: from tkinter import *class Application(Frame): def __init__(self,master=None): Frame.__init__(self,master) self.grid(sticky=N+S

Re: [Tutor] question about operator overloading

2012-03-05 Thread Dave Angel
On 03/05/2012 03:16 PM, Albert-Jan Roskam wrote: Hi, I am extending a program for a hobby project where potentially huge spss files are read. I would like to add functionality to append files. I thought it would be nice and intuitive to overload + and += for this. The code below is a gross si

Re: [Tutor] question about operator overloading

2012-03-05 Thread Dave Angel
On 03/05/2012 04:10 PM, Albert-Jan Roskam wrote: Hi Dave, aha! Good thing I asked. ;-) I've indeed been thinking where this __add__ method should live. The program as it is now has a Generic class, a Reader class and a Writer class. I thought an Append class was appropriate because it

Re: [Tutor] question about operator overloading

2012-03-05 Thread Dave Angel
On 03/05/2012 06:20 PM, Alan Gauld wrote: On 05/03/12 21:25, Dave Angel wrote: It's not clear what __add__() should mean for physical files. My guess would be similar to the cat operator in Unix: $ cat file1, file2 > file3 is equivalent to file3 = file1 + file2 But of course, th

Re: [Tutor] misunderstanding "any"

2012-03-07 Thread Dave Angel
On 03/07/2012 12:07 AM, col speed wrote: Then we have: a = tuple(range(10)) b = tuple(reversed(a)) any(a) in b True any(b) in a True any((a,b)) in (a,b) False # I think I understand this now, but I must admit it looks confusing! Thanks again Col None of those last three does anythi

Re: [Tutor] disutils

2012-03-08 Thread Dave Angel
On 03/08/2012 06:49 PM, Ejaj Hassan wrote: Hi, I was just going through a book on python and came across this 'disutils'. Can somebody explained to me about this. Regards, Ejaj Without mentioning the book, how are we supposed to guess what disutils is? Or perhaps you meant distutils? If so

Re: [Tutor] UnicodeEncodeError: 'cp932' codec can't encode character '\xe9' in position

2012-03-10 Thread Dave Angel
On 03/10/2012 06:38 PM, Robert Sjoblom wrote: Okay, so here's a fun one. Since I'm on a japanese locale my native encoding is cp932. I was thinking of writing a parser for a bunch of text files, but I stumbled on even printing the contents due to ... something. I don't know what encoding the text

Re: [Tutor] import pygame

2012-03-12 Thread Dave Angel
On 03/12/2012 07:25 PM, Tamar Osher wrote: Hello. I cannot successfully import third party modules. I have tried various things and searched online. Pygame is installed on my Windows 7 computer at C:\python32\pygame. Can someone please help me?>>>import pygameTraceback (most recent call la

Re: [Tutor] import pygame

2012-03-13 Thread Dave Angel
Three points of order, then a response, all at the proper place, after the portion of your message I'm quoting. On 03/13/2012 05:48 PM, Tamar Osher wrote: Dear Dave: Hi. Pygame is located in my computer at c:\Python32\Lib\site-packages\pygame. I am having difficulty importing and

[Tutor] Trying to send a cursor down key press string to a device

2012-03-17 Thread dave selby
from my mymobiler device instead of moving the highlighte down one line Any ideas Cheers Dave -- Please avoid sending me Word or PowerPoint attachments. See http://www.gnu.org/philosophy/no-word-attachments.html ___ Tutor maillist - Tutor

Re: [Tutor] 答复: Any book to study Python

2012-03-19 Thread Dave Angel
On 03/19/2012 09:36 PM, Yan, Xianming wrote: And to Brian vdB, I have my job need to do on windows platforms, and I installed python on a linux virtual machine hosted on my PC, so I can't copy/paste the code here. But it is a very good point that install the python interepter on Windows platf

Re: [Tutor] python sorting

2012-03-22 Thread Dave Angel
On 03/22/2012 06:01 PM, Sukhpreet Sdhu wrote: i want to sort the list formed by two variable taken as raw_input().i have written following code; a=raw_input() b=raw_input() c=a+b list=c.split() how i can sort the list formed Do a search on python.org for list + sort. First match I got: http:

Re: [Tutor] working with c_byte?

2012-03-23 Thread Dave Angel
On 03/23/2012 11:51 PM, Alex Hall wrote: Hi all, I am trying to read battery information. I found an example that sets up a ctypes structure to get the information from a kernel call, and it works... except that I just realized the values of some fields are added. For instance, a value of 1 means

Re: [Tutor] working with c_byte?

2012-03-23 Thread Dave Angel
On 03/24/2012 01:10 AM, Alex Hall wrote: Thanks, the& (bitwise operator) trick seems to be promising. Should I still mod by 256? If so, could you explain why, since the value cannot exceed 127? Also, how does that work if a possible vlaue is 255, according to the documentation? You top-posted

Re: [Tutor] working with c_byte?

2012-03-24 Thread Dave Angel
On 03/24/2012 04:14 AM, Alan Gauld wrote: On 24/03/12 03:51, Alex Hall wrote: Of course, 9 means the battery is high and charging, but how do I interpret an arbitrary integer as the sum of its flags? Is there a binary trick I can use? Dave has given the immediate answer which is a subset of

[Tutor] Strange ways of opening a file

2012-03-28 Thread Dave Angel
On 03/28/2012 06:17 AM, Yan, Xianming wrote: > Hello, > Without a meaningful title, it's unclear just what your question is. When you do a reply on the digest, delete all the parts that aren't relevant to your post, and change the subject line to something appropriate. > I'm new to studying pytho

Re: [Tutor] __class__.__name__ for literal integer causes SyntaxError

2012-04-05 Thread Dave Angel
On 04/04/2012 10:27 PM, Emile van Sebille wrote: > On 4/4/2012 6:27 PM Tim Johnson said... >> See the following console session: > 4.6.__class__.__name__ > > The first decimal is considered to be part of the float literal here... > > >> 'float' > 6.__class__.__name__ > > ... _and_ here... >

Re: [Tutor] How is the return statement working in this function?

2012-04-05 Thread Dave Angel
On 04/05/2012 08:39 PM, Greg Christian wrote: > I am just wondering if anyone can explain how the return statement in this > function is working (the code is from activestate.com)? Where does x come > from – it is not initialized anywhere else and then just appears in the > return statement. Any

Re: [Tutor] Running scripts at login

2012-04-05 Thread Dave Angel
On 04/05/2012 10:07 PM, Michael Lewis wrote: >> >> On 05/04/12 05:59, Michael Lewis wrote: >>> Hi everyone, >>> >>> I am researching how to automatically run some of my scripts after I log >>> into my Windows machine. I don't want to have to manually run the script >>> or setup a windows task. >> T

Re: [Tutor] How to have the name of a function inside the code of this function?

2012-04-06 Thread Dave Angel
On 04/06/2012 03:19 PM, Karim wrote: > Le 06/04/2012 19:31, Alan Gauld a écrit : >> On 06/04/12 09:47, Karim wrote: >> >>> If you have any idea to get the caller name inside the caller. >> >> >> Its not normally very helpful since in Python the same function can >> have many names: >> >> def F(x):

Re: [Tutor] Game of python, help please.

2012-04-09 Thread Dave Angel
On 04/09/2012 02:26 AM, leo degon wrote: > Hello all, Im trying to learn python and programming in my free time Welcome to the list; I think you'll enjoy Python programming, and think it makes an excellent first language. > , and > I'm trying to do a little personal project to trying and gain so

Re: [Tutor] Game of python, help please.

2012-04-09 Thread Dave Angel
On 04/09/2012 10:33 PM, bob gailer wrote: > On 4/9/2012 2:26 AM, leo degon wrote: >> Hello all, Im trying to learn python and programming in my free time, >> and I'm trying to do a little personal project to trying and gain >> some skills. Im trying to do version of John conways game of life. I >>

Re: [Tutor] summing lists

2012-04-10 Thread Dave Angel
On 04/10/2012 11:28 AM, Hs Hs wrote: > sorry I did this following, please advise if any better way exist: > You top-posted, so we lose the context you were using. You never really say why you're using lists with exactly one element in them, but presuming that the real lists consist of something l

Re: [Tutor] how to build a multiplayer game?

2012-04-11 Thread Dave Angel
On 04/11/2012 06:02 AM, Surya K wrote: > > I have written the basic part of the game. Now I want to make it a > multiplayer one. (Its not a web app, a OS application) > So, I just wanted to know how do it. > Which topics I should refer? Network Programming or Web Programming or > Internet Client

Re: [Tutor] Iterate Suggestion

2012-04-14 Thread Dave Angel
On 04/14/2012 01:55 PM, Tom Tucker wrote: > All, > Thanks for the help. Please try to post your messages AFTER the part you're quoting. Another very useful feature is enumerate(). Instead of doing for item in mylist: count += 1 if count... do something like: for index, item in enum

Re: [Tutor] Python Fails to Change Directory

2012-04-15 Thread Dave Angel
On 04/15/2012 01:32 AM, Steven D'Aprano wrote: > Andrew Jahn wrote: >> Hi all, >> >> I am attempting to use a Python program to change into a specified >> directory before executing some commands. However, when I call the >> Python >> program from my Unix shell (tcsh) using a command such as >> >>

Re: [Tutor] how to select a player to play first on a multiplayer game which runs on IRC

2012-04-19 Thread Dave Angel
On 04/19/2012 06:54 AM, Surya K wrote: > I am writing tic tac toe game which runs on IRC (i am using freenode now). > Each player will be a channel member. So, players send private messages > between each other to play game. This sounds fine but I need the below things > to get done, but I don't

Re: [Tutor] passing results between functions

2012-04-25 Thread Dave Angel
On 04/25/2012 05:36 AM, Gerhardus Geldenhuis wrote: > Hi > I wrote two functions which does different manipulations on text files. > > To start out with I passed the filename as a parameter and each function > opened the file and saved it. > > I then realized I would need to do that twice Do what

Re: [Tutor] Tutor Digest, Vol 98, Issue 70

2012-04-28 Thread Dave Angel
On 04/28/2012 11:00 AM, Osemeka Osuagwu wrote: > I use 64bit Windows7 and Python 2.7.2 (upgraded from 2.6.6) > > I downloaded the windows binary from the pygame site > (http://www.pygame.org/download.shtml) and ran it. During the > installation I had to choose install directory, I left it at the >

Re: [Tutor] Python Variable Addition

2012-04-30 Thread Dave Angel
On 04/30/2012 05:50 AM, viral shah wrote: > Hi > > I'm new in the learning of python > > I want to make simple code for two variable addition > > Please help me in the following code > > *x = 12 > print x > y =20 > print y > z = x+y > print 'Addition of above two numbers are : ' + int.z > * > when

Re: [Tutor] Is there space a between "#!" and "/usr/bin/env python" ?

2012-05-01 Thread Dave Angel
On 05/01/2012 09:55 AM, Santosh Kumar wrote: > Is there space a between "#!" and "/usr/bin/env python"? > > I have seen Python manual, it says <#! /usr/bin/env python> > But snippet manager of many text editing programs have <#!/usr/bin/env > python>. Python is a strongly typed language, which one

Re: [Tutor] binding a button to an entry

2012-05-01 Thread Dave Angel
On 05/01/2012 10:40 AM, ADRIAN KELLY wrote: > Hi all, Please can anyone tell me how i bind the activation of a button with > input from an entry widget. i know i should be using classes etc. but i don't > understand them fully yet.. problem here is that no matter what i enter in > the entry wind

Re: [Tutor] why i < j is True, j < k is False

2012-05-04 Thread Dave Angel
On 05/04/2012 09:29 AM, Lion Chen wrote: > Hi, All, > here are the codes: > > class a: > pass > > > i = a () > j = a () > k = a () > > i < j returns True > > j < k returns False > > why? > > Lion Chen > ___ > Tutor maillist - Tutor@python.org > To unsub

Re: [Tutor] What does L at last stands for when 10 ** 30

2012-05-04 Thread Dave Angel
On 05/04/2012 09:57 AM, Santosh Kumar wrote: > I am doing: power = 10 ** 30 power > and the output: 1...L # what does L represent > interesting thing is L doesn't shows when I do a: print power > ___ The L stands for "long".

Re: [Tutor] How can I have type "function" in my script?

2012-05-07 Thread Dave Angel
On 05/07/2012 02:24 PM, xancorreu wrote: > Hi, > > I have this script: > > from types import * > Bad idea. Once you do that, you can silently overwrite globals in your own module with stuff that the current version of types happens to have in it. Besides, it then becomes very hard to read your pr

Re: [Tutor] How can I have type "function" in my script?

2012-05-07 Thread Dave Angel
On 05/07/2012 03:11 PM, Joel Goldstick wrote: > On Mon, May 7, 2012 at 3:07 PM, Dave Angel wrote: >> On 05/07/2012 02:24 PM, xancorreu wrote: >>> Hi, >>> >>> I have this script: >>> >>> from types import * >>> >> Bad idea.

Re: [Tutor] How can I have type "function" in my script?

2012-05-07 Thread Dave Angel
On 05/07/2012 04:37 PM, xancorreu wrote: > Al 07/05/12 21:07, En/na Dave Angel ha escrit: >> On 05/07/2012 02:24 PM, xancorreu wrote: >>> Hi, >>> >>> I have this script: >>> >>> from types import * >>> >> Bad idea. Once you d

Re: [Tutor] Curious dictionary printing

2012-05-08 Thread Dave Angel
On 05/08/2012 07:27 AM, Cranky Frankie wrote: > On Mon, May 7, 2012 at 10:31 PM, bob gailer wrote: > >> Asking why does it not do what I want is not IMHO the best way to win >> friends here. > Good morning to you to, Bob. > > I see now that dictionaries in Python act like relational databases in >

Re: [Tutor] Sorting the Parts of a Dictionary into a List

2012-05-08 Thread Dave Angel
On 05/08/2012 05:23 PM, Jacob Bender wrote: > > > > def smartest(self): #Return the neurons in order from smartest to > dumbest in list form. > for neuron in self.neurons: > sorted(neuron, key=self.total(neuron)) > > The total function works when it returns the strength of

Re: [Tutor] Script to search in string of values from file A in file B

2012-05-09 Thread Dave Angel
On 05/09/2012 10:00 AM, Afonso Duarte wrote: > Dear All, > > > > I'm new to Python and started to use it to search text strings in big > (>500Mb) txt files. > > I have a list on text file (e.g. A.txt) that I want to use as a key to > search another file (e.g. B.txt), organized in the following w

Re: [Tutor] Script to search in string of values from file A in file B

2012-05-09 Thread Dave Angel
On 05/09/2012 11:04 AM, Afonso Duarte wrote: > > > -Original Message- > From: Dave Angel [mailto:d...@davea.name] > >> >> Please post your messages as plain-text. The double-spacing I get is >> very annoying. > > Sorry for that my outlook me

Re: [Tutor] Script to search in string of values from file A in file B

2012-05-09 Thread Dave Angel
> > > If you really have to handle the case where there is a final key with no > data, then you'll have to detect that case, and make up the data > separately. That could be done with a try block, but this is probably > clearer: > > rawlines = object.readlines() > if len(rawlines) %2 != 0: >

Re: [Tutor] Script to search in string of values from file A in file B

2012-05-10 Thread Dave Angel
On 05/10/2012 04:20 AM, Afonso Duarte wrote: > Dear All, > > Thanks Joel and Walter, both solutions worked nicely and produced the desired > final objective! > > Short answer to Alan Gauld, far from me to start answering all your points, > but I guess I should answer to the most pertinent ones:

Re: [Tutor] odd behavior when renaming a file

2012-05-10 Thread Dave Angel
On 05/10/2012 12:56 PM, Alan Gauld wrote: > On 09/05/12 20:26, Joel Goldstick wrote: >> import os >> def pre_process(): >> if os.path.isfile('revelex.csv'): >> os.rename('revelex.csv', 'revelex.tmp') >> print "Renamed ok" >> else: >> print "Exiting, no revelex.c

Re: [Tutor] Auto-response for your message to the "Tutor" mailing list

2012-05-13 Thread Dave Angel
On 05/13/2012 04:17 AM, Alan Gauld wrote: > On 13/05/12 07:21, Steven D'Aprano wrote: >> Devin Jeanpierre wrote: >>> This is the third time I've received a message "for those of you new >>> to the Tutor list". When does it stop? > > I think these come when the listserver gets a message from a mailb

Re: [Tutor] syntax error

2012-05-13 Thread Dave Angel
On 05/13/2012 05:44 AM, Steven D'Aprano wrote: > Devin Jeanpierre wrote: >> On Sat, May 12, 2012 at 10:29 PM, bob gailer wrote: >>> oh - and always provide a specific meaningful subject >> >> My client has no idea what thread this post came from. >> >> Is it supposed to? > > > What's your client?

Re: [Tutor] sorry seems like it was sent in html

2012-05-13 Thread Dave Angel
On 05/13/2012 07:22 PM, Keitaro Kaoru wrote: > is that better? not html... ? Your message is still html. The following section of code shows no indentation, so is very hard to interpret. > > def seen(mgr, room, user, msg, args): > name = args.lower().split(" ")[0] > if not name.isalnum(): retu

Re: [Tutor] (no subject)

2012-05-14 Thread Dave Angel
On 05/14/2012 05:58 AM, Keitaro Kaoru wrote: > sorry if i keep missing this up. > > hey. Austin here for some reason this command. all it does it produces the > error message at the bottom.. itll say my name and the persons name im > trying to send the message to but thats it. heres the command. I

Re: [Tutor] Translating R Code to Python-- reading in csv files, writing out to csv files

2012-05-20 Thread Dave Angel
Please don't top-post. You lose the context of what was written before, since it's now out of order. When replying to a message, quote the parts you're replying to, and put your comments AFTER the quotes. On 05/19/2012 05:07 PM, Benjamin G wrote: > Thanks, Joel. Here is a simple example of the

Re: [Tutor] Is this possible and should it be done?

2012-05-21 Thread Dave Angel
On 05/21/2012 06:38 AM, wolfrage8...@gmail.com wrote: > All, I have had a curious idea for awhile, and was wondering the best > way to implement it in Python and if it is even possible. The concept > is this, a file that is actually a folder that contains multiple files > (Like an Archive format).

Re: [Tutor] removing sq. of items.

2012-05-23 Thread Dave Angel
On 05/23/2012 06:07 AM, Bala subramanian wrote: > Hi, > I infact want write each of the item in the sliced list to a file. This line is top-posted. Please put your remarks *after* the part you've quoted. There isn't one slice, but many of them. So you have a list of lists. > > On Wed, May 23, 20

Re: [Tutor] Meaningless

2012-05-27 Thread Dave Angel
On 05/27/2012 01:03 PM, Kimberly McManus wrote: > help > > Sure. Head for the nearest exit, stopping before each door to make sure it's not hot before opening it. Once outside, call 911 (or your local emergency number), and report the fire, being sure to describe your location exactly, and anyth

Re: [Tutor] Meaningless

2012-05-27 Thread Dave Angel
On 05/27/2012 04:37 PM, Brian van den Broek wrote: > On 27 May 2012 20:52, "Dave Angel" wrote: >> >> On 05/27/2012 01:03 PM, Kimberly McManus wrote: >>> help >>> >>> >> >> Sure. Head for the nearest exit, stopping before each

Re: [Tutor] Concatenating Strings

2012-05-28 Thread Dave Angel
On 05/28/2012 10:00 PM, Jeremy Duenas wrote: > I am trying to understand the point behind using the '+' character when > trying to concatenate strings. I am new to learning Python and going through > the book "Python Programming for Absolute Beginners 3rd ed." and do not > understand the point or

Re: [Tutor] Loop Question - Beginner Help (Thanks in Advance)

2012-05-29 Thread Dave Angel
On 05/29/2012 08:46 PM, Joseph Rishe wrote: > #Operating System - Mac OS X 10.6.8 > #Python Version - Python 2.6.6 > > > > ##Goal: I am creating a program to calculate credit card payments. > ## The user should be able to put in a credit card balance and > interest > ## rate, and the p

Re: [Tutor] Joining all strings in stringList into one string

2012-05-30 Thread Dave Angel
On 05/30/2012 12:21 PM, Akeria Timothy wrote: > Hello all, > > I am working on learning Python(on my own) and ran into an exercise that I > figured out but I wanted to know if there was a different way to write the > code? I know he wanted a different answer for the body because we haven't > gotten

Re: [Tutor] Joining all strings in stringList into one string

2012-05-30 Thread Dave Angel
A procedural point here: You forgot to include the list, and just replied to me privately. Normally, what you should do is a Reply-All. Or else make sure tutor@python.org is one of the To: or CC: list On 05/30/2012 01:40 PM, Akeria Timothy wrote: > I did copy and paste and I'm learning Pyth

Re: [Tutor] use the data None

2012-06-04 Thread Dave Angel
On 06/04/2012 06:14 AM, Tehn Yit Chin wrote: > Thanks for the quick answers. > > The potential for the variable not to exists is when I am using the > optparser module, and I want to check if a particular parameter was passed > in or not. If the parameter was not passed in, then the variable would

[Tutor] Threads, ok to access parent script methods by passing 'self' ?

2012-06-05 Thread dave selby
Hi All, If a thread is started and 'self' is passed as a parameter, is it acceptable to access methods of the calling class via 'self.updateGrid()' etc from within the thread or does everything have to be done via wx.lib.pubsub and publisher calls ? Cheers Dave --

Re: [Tutor] Threads, ok to access parent script methods by passing 'self' ?

2012-06-05 Thread dave selby
On 5 June 2012 12:05, dave selby wrote: > I was running the thread by instantiating a separate class but this > will make the very neat CallAfter() difficult, is it OK to call a > method in the main class as a thread in which case the CallAfter() > should work OK ? > > Tha

Re: [Tutor] Searching 2 Strings in A File

2012-06-06 Thread Dave Angel
On 06/06/2012 03:33 PM, dohoang4...@comcast.net wrote: > i am writing a python script that will be invoked as follows: > > myScript.py > > and the script is as follwos: > > x = "Device " + sys.argv[1] + " restored the database" > y = "Created connection to " + sys.argv[1] > > cmd_line = Popen

Re: [Tutor] Notepad++ question

2012-06-06 Thread Dave Angel
On 06/07/2012 12:29 AM, Alexander Quest wrote: > Hey all; my question is regarding editing Python code in Notepad++. When I > run this piece of code in Notepad++: > > def fix_start(s): > var1 = s[0] > var2 = "*" > var3 = s.replace(var1, var2) > > return var3 > > > I get an indentation err

Re: [Tutor] Notepad++ question

2012-06-07 Thread Dave Angel
On 06/07/2012 02:36 PM, Alexander Quest wrote: > Ok, thanks guys. I also had one more quick question regarding a piece of > boilerplate code: > To get a response, you will needs to leave your question at the python tutor newsgroup. We are part of a group, not offering private advice. Normally,

Re: [Tutor] Finding palindromes in a list

2012-06-08 Thread Dave Angel
On 06/08/2012 09:01 PM, Marc Tompkins wrote: > On Fri, Jun 8, 2012 at 5:10 PM, Mike Nickey wrote: > >> def compareElements(wordList): >>for item in wordList(): >>if item == item.reversed(): >>print item >>else: >>next(item) >> >> > reversed() is not a st

Re: [Tutor] Finding palindromes in a list

2012-06-08 Thread Dave Angel
On 06/08/2012 09:46 PM, Mike Nickey wrote: > Thanks guys, > You top-posted your comments, so we lose all context. Put your remarks after the part you're quoting. Or if the stuff you're quoting is irrelevant, strip it out, as I've done here. It's irrelevant because the order is wrong. > Those h

<    6   7   8   9   10   11   12   13   14   15   >