Re: [Tutor] following on

2013-02-18 Thread Dave Angel
On 02/18/2013 02:01 PM, Matthew Ngaha wrote: i sort of heard about a stack its a C/C++ thing i think? A stack is fundamental to modern programming languages. The only two machines I've used that didn't have a stack implemented at the machine level were the CDC 6000 series, and the IB

Re: [Tutor] help with storing money variable

2013-02-19 Thread Dave Angel
On 02/19/2013 07:36 AM, Ghadir Ghasemi wrote: Hi guys, Iam halfway through my vending machine program that I started earlier. I ran into a problem. When the user inserts some money, The money variable is not stored for until the user buys an item. So what happens is when the users inserts some

Re: [Tutor] distance between cities matrix

2013-02-21 Thread Dave Angel
On 02/21/2013 07:16 AM, Mara Kelly wrote: Hi everyone, Here is the question I was given...Consider the (20x20) array of numbers here(I wrote all of the numbers in my program). Lets say this represents a matrix A of distances (in kilometers) between cities. Note that A is symmetric A(i,j) = A(j,

Re: [Tutor] How to break long lines?

2013-02-22 Thread Dave Angel
On 02/22/2013 08:22 PM, Jim Byrnes wrote: Thanks for giving me so many options to use in the future. When reading I completely blew by the single quote on a single line part. The db is sqlite3 and it seems happy with ''' strings. FWIW, there is absolutely no difference between a stri

Re: [Tutor] object attribute validation

2013-02-22 Thread Dave Angel
On 02/22/2013 09:26 PM, Robert Sjoblom wrote: I would like to validate data attributes before the object is instantiated or any changes thereafter. For example, following is a simple Person class with name and age attributes. [snip] Following is my example code: class Person(object): def __

Re: [Tutor] How to break long lines?

2013-02-22 Thread Dave Angel
On 02/22/2013 09:40 PM, Don Jennings wrote: On Feb 22, 2013, at 9:12 PM, tutor-requ...@python.org wrote: Message: 5 Date: Fri, 22 Feb 2013 21:03:00 -0500 From: Dave Angel Did you read the beginning of that digest? It said to make sure and rename the subect line. Tutor Digest isn&#

Re: [Tutor] getting and using information dict objects

2013-02-23 Thread Dave Angel
On 02/23/2013 09:40 PM, Matthew Johnson wrote: For the sake of those who finds this thread -- the date / value pairs can be printed by the following: import fred fred.key(fredKey) gnpObvs = fred.observations('GNPCA') for i in range(1, len(gnpObvs['observations']['observation'])): print g

Re: [Tutor] How to change the char in string for Python

2013-02-24 Thread Dave Angel
Both your later remarks are top-posted, ruining the sequence of who posted what. On 02/24/2013 06:57 AM, Sudo Nohup wrote: Thanks for your help. I just found a webpage used for me: http://stackoverflow.com/questions/10017147/python-replace-characters-in-string That page provides some other so

Re: [Tutor] Second follow up

2013-02-26 Thread Dave Angel
On 02/26/2013 09:23 AM, Jack Little wrote: How would I go from one def statement to another? I am developing a text based rpg. Sent from my iPod ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.

Re: [Tutor] Problem with os.system

2013-03-01 Thread Dave Angel
On 03/01/2013 08:07 AM, Vijay Kumar R wrote: I was using python for some application which used to create directories and also to run some exes using the os.system command from a program.py file which was working fine. For some reasons I got my system formatted and got the windows 7 installed.

Re: [Tutor] Reversed dictionary returned by default

2013-03-01 Thread Dave Angel
On 03/01/2013 02:48 PM, Huperetes wrote: I am getting the following for my installation. Why is this happening, and how do I get it to work properly (returning element 0 - n, versus n - 0)? Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyrigh

Re: [Tutor] A CSV field is a list of integers - how to read it as such?

2013-03-03 Thread Dave Angel
On 03/03/2013 09:24 PM, DoanVietTrungAtGmail wrote: Dear tutors I am checking out csv as a possible data structure for my records. In each record, some fields are an integer and some are a list of integers of variable length. I use csv.DictWriter to write data. When reading out using csv.DictRea

Re: [Tutor] A CSV field is a list of integers - how to read it as such?

2013-03-04 Thread Dave Angel
On 03/04/2013 01:48 AM, DoanVietTrungAtGmail wrote: Don, Dave - Thanks for your help! Don: Thanks! I've just browsed the AST documentation, much of it goes over my head, but the ast.literal_eval helper function works beautifully for me. Dave: Again, thanks! Also, you asked "More space efficient

Re: [Tutor] some web and python version questions

2013-03-04 Thread Dave Angel
On 03/04/2013 11:30 AM, Lolo Lolo wrote: Hey all, i am running python 3.0 but i realized a lot of modules that support version 3 do not support 3.0. now i want to install Python 3.3 but im worried the two versions (3.0 and 3.3) might confuse my machine. i don't want to lose my work in 3.0 and

Re: [Tutor] print label error

2013-03-04 Thread Dave Angel
On 03/04/2013 07:28 PM, Pravya Reddy wrote: Hi I am having a builtin intendation error for print Addem(3,2).Does it vary for different versions of python? How to clear the error? def Addem(this, that): return this + that print Addem(3, 2) The print statement doesn't line up with t

Re: [Tutor] some web and python version questions

2013-03-04 Thread Dave Angel
(Please get the quoting right in your messages. Either you've got a brain-dead mail program, or you're trying to bypass it's methods. On your last message you attributed Eryksun's comments as though they were your own.) On 03/04/2013 09:49 PM, Lolo Lolo wrote: no sorry i made a mistake it

Re: [Tutor] some web and python version questions

2013-03-04 Thread Dave Angel
On 03/04/2013 11:57 PM, eryksun wrote: On Mon, Mar 4, 2013 at 10:54 PM, Lolo Lolo wrote: no if i double click the .py file, Python 3.3 opens all of my python 3 files. A lot of 3.0 files won't run but that's okay. Now on my command line if i enter the correct version's directory, and use: python

Re: [Tutor] some web and python version questions

2013-03-05 Thread Dave Angel
On 03/05/2013 02:43 AM, Lolo Lolo wrote: Installing 3.3 associated .py files with %windir%\py.exe, but it seems the icon cache wasn't refreshed. You can trigger a refresh by setting any default in the "Default Programs" control panel applet. If that fails, you can manually delete the cache fro

Re: [Tutor] A CSV field is a list of integers - how to read it as such?

2013-03-06 Thread Dave Angel
On 03/06/2013 09:05 PM, DoanVietTrungAtGmail wrote: Once a csv file has been read by a csv reader (such as DictReader), it's no longer a csv file. That was an "Aha!" moment for me. The file is on disk, each row of it is in memory as a list or dict, and it's the list or dict that matters. It's

Re: [Tutor] BMI calc

2013-03-12 Thread Dave Angel
On 03/12/2013 09:46 PM, Mark Lawrence wrote: On 13/03/2013 00:05, Soliman, Yasmin wrote: Hello all, I'm new to python and its been a stuggle so far. I'm attempting to create a BMI calculator in Wing 101 4.1. I keep getting syntax errors: def calc_BMI(weight,height): return (weight/(height

Re: [Tutor] BMI calc

2013-03-13 Thread Dave Angel
On 03/13/2013 02:17 AM, Jos Kerc wrote: Hi, On Wed, Mar 13, 2013 at 4:07 AM, Soliman, Yasmin wrote: def calc_BMI(weight,height): if bmi <=18.5: return 'underweight' elif bmi >= 18.5 and bmi <=24.9: return 'normal weight' elif bmi >=25 and bmi <=29.9: F

Re: [Tutor] increment a counter inside generator

2013-03-13 Thread Dave Angel
On 03/13/2013 03:50 PM, Abhishek Pratap wrote: Hey Guys I might be missing something obvious here. import numpy as np count = 0 [ count += 1 for num in np.random.random_integers(1,100,20) if num > 20] File "", line 2 [ count += 1 for num in np.random.random_integers(1,100,20) if num >

Re: [Tutor] p.s.

2013-03-13 Thread Dave Angel
On 03/13/2013 11:14 AM, Joshua Wilkerson wrote: It was even giving me a syntax error when said code was in a comment. Really useful question, where you break the thread, change the subject, don't quote anything from earlier, and don't bother identifying anything about your environment. Go

[Tutor] Fwd: Which databases allow lists as record fields?

2013-03-13 Thread Dave Angel
I presume you meant this for the tutor list. I don't have any answers for the question. Original Message Subject: [Tutor] Which databases allow lists as record fields? Date: Thu, 14 Mar 2013 10:59:27 +1100 From: DoanVietTrungAtGmail To: Dave Angel Dear tutor

Re: [Tutor] Passing a config file to Python

2013-03-14 Thread Dave Angel
On 03/14/2013 02:22 PM, Irina I wrote: Hi all, I'm new to Python and am trying to pass a config file to my Python script. The config file is so simple and has only two URLs. The code should takes that configuration file as input and generates a single file in HTML format as output. The progr

Re: [Tutor] break

2013-03-14 Thread Dave Angel
On 03/14/2013 06:38 PM, Matthew Ngaha wrote: i cant seem to break out of this loop. let me explain the variables you see: if Enemy.ships: for missile in self.missiles: flag = False for rect in Enemy.rects:

Re: [Tutor] break

2013-03-14 Thread Dave Angel
On 03/14/2013 07:23 PM, Matthew Ngaha wrote: if Enemy.ships: for missile in self.missiles: flag = False for rect in Enemy.rects: assert(!flag) if QPoint(miss

Re: [Tutor] Getting os.walk output into a list

2013-03-14 Thread Dave Angel
On 03/15/2013 01:53 AM, Paradox wrote: There is something I can't figure out about the following code (using python 2.7.3): def return_tree_files(rootpath, pattern): for root, dirs, files in os.walk(rootpath): i = [os.path.join(root, filename) for filename in fnmatch.filter(files,

Re: [Tutor] Random Python Tip

2013-03-15 Thread Dave Angel
On 03/15/2013 03:57 AM, Mark Lybrand wrote: I seem to remember a web page that generated a random Python programming tip. However my Google Fu is weak today. Does anyone recall the URL of what I am talking about? Closest that I've seen is the "Module of the Week" http://www.doughellmann.c

Re: [Tutor] func-question_y_n.py

2013-03-15 Thread Dave Angel
On 03/15/2013 06:09 PM, Christopher Emery wrote: -- Hugo said: 1. ask a question, receive an answer 2. if the answer is "Yes" or "No", return the answer 3. else, print a message and go back to step 1 Hello Hugo, # Defines the start of a function and its options (question)

Re: [Tutor] __init__ doesn't seem to be running

2013-03-15 Thread Dave Angel
(By top-posting, you lost all the context. Next time, post your responses AFTER the part you're quoting. And don't just quote it all, only the part that's relevant.) On 03/15/2013 06:25 PM, Cameron Macleod wrote: I added the "self." to both the references to tasks and then I added the print

Re: [Tutor] __init__ argument

2013-03-15 Thread Dave Angel
On 03/15/2013 06:46 PM, Joshua Wilkerson wrote: The program keeps telling me that the __init__ in Rock takes two arguments and only one is given. Ideas? The point of the game is to dodge falling rocks. Two more appear every time one reaches the bottom of the screen. # Avalanche, a dodging game

Re: [Tutor] Script to generate statements

2013-03-15 Thread Dave Angel
On 03/15/2013 08:53 PM, Alan Gauld wrote: On 15/03/13 19:42, Charles Leviton wrote: Given a list of DBRM members create a JCL which has a series of bind statements for each DBRM. Ah, the joys of JCL. I haven't read a JCL script in about 15 years! :-) Been over 40 years for me, so I may not

Re: [Tutor] Fixing Globals

2013-03-16 Thread Dave Angel
On 03/16/2013 03:04 PM, ke...@kendy.org wrote: Dear Tutor Global constants and variables are bad. First, let me define my own "rule." Global constants should be all uppercase, and global variables should be avoided. Trivial and buggy scripts may ignore both rules. A trivial script is typic

Re: [Tutor] Scripting Calligra sheets with Python

2013-03-18 Thread Dave Angel
On 03/18/2013 12:18 PM, Jim Byrnes wrote: I am trying to script Calligra Sheets (formerly KSpread) with python. I have gotten some of the included example scripts to run so I know python scripting is running. I found the following snippet on their website: import KSpread sheet = KSpread.view()

Re: [Tutor] Scripting Calligra sheets with Python

2013-03-18 Thread Dave Angel
On 03/18/2013 09:56 PM, Jim Byrnes wrote: On 03/18/2013 07:54 PM, Dave Angel wrote: On 03/18/2013 12:18 PM, Jim Byrnes wrote: I am trying to script Calligra Sheets (formerly KSpread) with python. I have gotten some of the included example scripts to run so I know python scripting is running

Re: [Tutor] Help

2013-03-20 Thread Dave Angel
On 03/20/2013 03:57 PM, travis jeanfrancois wrote: Hello, I am a beginning python student and I am having trouble with a program I am writing . The problem requires me to use "while" and that I create a function that allows the user to a create sentence by inputing a string and to end the sent

Re: [Tutor] Please Help

2013-03-21 Thread Dave Angel
On 03/21/2013 06:42 AM, Arijit Ukil wrote: I am new to python. Since you're new to Python, I won't try to supply you an answer using list comprehensions, since you've probably not learned them yet. I like to calculate average of the numbers by reading the file 'digi_2.txt'. I have written

Re: [Tutor] Please Help

2013-03-21 Thread Dave Angel
On 03/21/2013 08:09 AM, Arijit Ukil wrote: Thanks for the help. You're welcome. You replied privately, instead of including the list, so I'm forwarding the response so everyone can see it. You also top-posted, so the context is backwards. After running your code, I am getting the follow

Re: [Tutor] Importing data from a file.

2013-03-21 Thread Dave Angel
On 03/21/2013 09:43 AM, Shall, Sydney wrote: I have an elementary question provoked by another post today. 1. Is it the case that ALL imported data from a file is a string? No, the imported data is a module. For example import sys print type(sys) At this point, sys is a object of

Re: [Tutor] Importing data from a file.

2013-03-21 Thread Dave Angel
On 03/21/2013 10:03 AM, Dave Angel wrote: A typo below; sorry. On 03/21/2013 09:43 AM, Shall, Sydney wrote: I have an elementary question provoked by another post today. 1. Is it the case that ALL imported data from a file is a string? No, the imported data is a module. For example

Re: [Tutor] Overriding equality tests in Python

2013-03-23 Thread Dave Angel
On 03/23/2013 12:08 AM, Robert Sjoblom wrote: You already got lots of good answers. But I want to explicitly point out a bug in your code (2 places) that was only indirectly mentioned. class Outcome(): def __init__(self, name): #Ignoring odds for now self.name = name def

Re: [Tutor] Overriding equality tests in Python

2013-03-23 Thread Dave Angel
On 03/23/2013 10:35 AM, Robert Sjoblom wrote: As I said, I don't really understand why a roulette outcome has a name in the first place, but given that it does, I don't any problem with comparing the names directly. Still, I would probably write it as an __eq__ method, since it's easier to write

Re: [Tutor] Chapter 3 Projects

2013-03-24 Thread Dave Angel
On 03/24/2013 07:38 PM, Mariel Jane Sanchez wrote: Hi, I'm sort of new to Python. I'm taking Computer Science 10 and I'm now on Chapter 3. I don't really get how to do the first three projects. Okay, so for the first project, I don't know how to input the ranges like 0-999, 1000-, 1+ a

Re: [Tutor] Dictionaries and multiple keys/values

2013-03-26 Thread Dave Angel
On 03/26/2013 12:36 AM, Robert Sjoblom wrote: Hi again, Tutor List. I am trying to figure out a problem I've run into. Let me first say that this is an assignment, so please don't give me any answers, but just nudge me in the general direction. So the task is this: from a text file, populate thr

Re: [Tutor] PyDtls

2013-03-26 Thread Dave Angel
On 03/26/2013 08:16 AM, Mousumi Basu wrote: I have installed PyDtls from the link:-" https://pypi.python.org/pypi/Dtls/0.1.0";. While creating the server and client objects in "sslconnection.py", it is referring to "x509.py" for certificates. Following error is o

Re: [Tutor] Udp socket questio

2013-03-26 Thread Dave Angel
On 03/26/2013 07:30 AM, Phil wrote: Thank you for reading this. I'm a bit out of my depth here. I'm attempting to set up a simple udp client. The example that follows results in an error message and I'm wondering if I should be importing a different module. A Google search doesn't support that

Re: [Tutor] argparse iterable

2013-04-01 Thread Dave Angel
On 04/01/2013 09:31 PM, Mark Lawrence wrote: On 02/04/2013 01:31, ke...@kendy.org wrote: Dear Tutor I want to compare command line options, to options in a dictionary from a YAML file. The command line will over-ride the options in my file. (The YAML file, and its dictionary are not shown. That

Re: [Tutor] argparse iterable

2013-04-02 Thread Dave Angel
On 04/01/2013 10:34 PM, Mark Lawrence wrote: On 02/04/2013 02:37, Dave Angel wrote: On 04/01/2013 09:31 PM, Mark Lawrence wrote: for a in vars(parser.parse_args()): print('This arg is %s' % a) http://docs.python.org/3/library/argparse.html#the-namespace-object Please don&#x

Re: [Tutor] argparse iterable

2013-04-02 Thread Dave Angel
On 04/01/2013 10:28 PM, ke...@kendy.org wrote: You guys are awesome! You make it look easy and I learn every time. Once you've got the two dicts, take a look into the update method. It may make any loops unnecessary, except for debugging. -- DaveA _

Re: [Tutor] Proper uses of classes

2013-04-03 Thread Dave Angel
On 04/03/2013 03:43 PM, frank ernest wrote: Hi guys, it's been a while since I posted and I've learned a lot since then. Today I have a question on classes, I can't get mine to work. Welcome back. I'll try. First comment is that indentation ought to be 4 columns, until you have enough exper

Re: [Tutor] Doubt in for loop

2013-04-03 Thread Dave Angel
On 04/03/2013 09:53 PM, Steven D'Aprano wrote: On 04/04/13 12:29, bessenkphilip wrote: Hi all, I'm having a doubt in the below program's 2n'd "for" loop. for n in range(2, 10): ... for x in range(2, n): ... if n % x == 0: ... print n, 'equals', x, '*', n/x ...

Re: [Tutor] The game of nim in python

2013-04-04 Thread Dave Angel
On 03/27/2013 08:30 AM, Yasin El Guennouni wrote: Hello, I am trying to modify a game of nim code. The game in the code works as: "You need to remove from 1 to 3 straws from the pile. The player that removes the final straw is the loser." But I would like it to be like the classic game, where

Re: [Tutor] Proper uses of classes

2013-04-05 Thread Dave Angel
On 04/04/2013 01:01 PM, frank ernest wrote: Sorry about the indentation guys my mail service atomatically removed it when I pasted the text (I tried to fix it by hand but it was hard to tell if I was sucessful.) I was tring to create a list object (self) and change it using the list methods an

Re: [Tutor] basic question

2013-04-05 Thread Dave Angel
On 04/05/2013 08:05 AM, Najam Us Saqib wrote: Hi, My name is Najam, I am very new to Python Programming. Welcome. Would you please help me with the following question? The question/problem is, Write a Car salesman program where the user enters the base price of a car. The program should

Re: [Tutor] While loop

2013-04-06 Thread Dave Angel
On 04/06/2013 11:23 PM, Najam Us Saqib wrote: Hi, Would you please help me by explaining that why " 5 " is skipped and not printed in the following program? Seems to me the comments say it pretty well. The continue statement causes execution to continue at the while statement, which has th

Re: [Tutor] While loop

2013-04-06 Thread Dave Angel
On 04/06/2013 11:23 PM, Najam Us Saqib wrote: Hi, Would you please help me by explaining that why " 5 " is skipped and not printed in the following program? Seems to me the comments say it pretty well. The continue statement causes execution to continue at the while statement, which has th

Re: [Tutor] if statement problems(noob question)

2013-04-08 Thread Dave Angel
On 04/08/2013 06:21 AM, Max Smith wrote: Hi, everyone whom might read this, im Max and i am really new to coding, been going at it for about two weeks using codeacademy and the book "think python". when i decided to experiment a little with if statements i ran into the following problem: def plu

Re: [Tutor] if statement problems(noob question)

2013-04-08 Thread Dave Angel
On 04/08/2013 06:37 AM, Woody 544 wrote: Max, You've made the arguments a string (so never a number) in: print "The answer is: " + str(x+y) MJ That has nothing to do with the issue. The str() function call is unnecessary, but harmless. If the two values x and y are ints or floats, they w

Re: [Tutor] if statement problems(noob question)

2013-04-08 Thread Dave Angel
On 04/08/2013 07:55 AM, Steven D'Aprano wrote: On 08/04/13 20:45, Dave Angel wrote: will always fail, since the integer 2 is not equal to the type int. In Python 2.x, when you compare objects of different types, you generally get unequal. (Exception, if you define your own classes, yo

Re: [Tutor] How to extract a float from an instancemethod call

2013-04-08 Thread Dave Angel
On 04/08/2013 08:40 AM, Sydney Shall wrote: Hi, I am learning Python. I use MAC OSX 10.6.8 Python 2.7.3 I have been given a project to write a program involving random walks. I have drafted a program which has passed all the static tests, but on testing my program i get the following error mes

Re: [Tutor] FYI: An Introduction to Interactive Programming in Python

2013-04-08 Thread Dave Angel
On 04/08/2013 07:58 PM, Steven D'Aprano wrote: On 09/04/13 06:38, brian arb wrote: An Introduction to Interactive Programming in PythonJoe Warren, Scott Rixner, Stephen Wong and John Greiner This course is designed to be a fun introduction to the basics of programming in Python. Our main focus

Re: [Tutor] How to make a python script run on startup

2013-04-09 Thread Dave Angel
On 04/09/2013 04:20 AM, daedae11 wrote: On Windows, how to make a python script run on startup? Windows has a system scheduler, which you can add entries to, specifying what time(s) a particular entry is to run. One of the choices is system startup. -- DaveA

Re: [Tutor] How to make a python script run on startup

2013-04-09 Thread Dave Angel
On 04/09/2013 05:54 AM, Alexander Mark wrote: On Apr 9, 2013, at 4:20, daedae11 wrote: On Windows, how to make a python script run on startup? _ (Top-posted comment moved AFTER the question) > There is a startup folder, usually on the start menu, you can add the script to. > But does an

Re: [Tutor] Flip a coin

2013-04-09 Thread Dave Angel
On 04/09/2013 07:50 AM, Najam Us Saqib wrote: Hi, This program is killing me, I have been working on it for last 3 hours, I have tried my best but can't make it work, please help me out. The Problem: Create a program that flips a coin 100 times and than tells you the number of tails and head

Re: [Tutor] How to make a python script run on startup

2013-04-09 Thread Dave Angel
On 04/09/2013 06:58 AM, daedae11 wrote: (Please don't top-post. And don't forget to include the list in your cc. I'm forwarding it for you) Which module to should I use to add entries to that system scheduler? The system scheduler is an interactive (gui) program that comes with the OS.

Re: [Tutor] Chapter 3 Projects

2013-04-09 Thread Dave Angel
On 04/09/2013 08:29 PM, ALAN GAULD wrote: Forwarded to group. Please use ReplyAll when responding to tutor posts. From: Mariel Jane Sanchez To: Alan Gauld Sent: Wednesday, 10 April 2013, 1:06 Subject: Re: [Tutor] Chapter 3 Projects Thank you so much, I fin

Re: [Tutor] Impossible Else as Exception

2013-04-10 Thread Dave Angel
On 04/10/2013 02:18 AM, Jordan wrote: Thank you all for the feedback and suggestions. I have never used an assertion, before so I will read up on the concept. One comment about assertion. Even though an optimized run will ignore the assertion itself, it can save a (small) amount of time avo

Re: [Tutor] running python from windows command prompt

2013-04-10 Thread Dave Angel
(Please don't hijack a thread with an unrelated question. You're no doing yourself any favors, as any decent thread-viewer will hide your new subject line, and group the whole thread with its original title. That can cause your query to be ignored by many of the readers.) To start a new threa

Re: [Tutor] Running python from windows command prompt

2013-04-10 Thread Dave Angel
On 04/10/2013 08:32 AM, Arijit Ukil wrote: I like to run a python program "my_python.py" from windows command prompt. This program ( a function called testing) takes input as block data (say data = [1,2,3,4] and outputs processed single data. import math def avrg(data): return sum(data)/len

Re: [Tutor] File not found error, but it is in the folder!

2013-04-10 Thread Dave Angel
On 04/10/2013 10:44 AM, Woody 544 wrote: I have a script that worked before I moved it to another folder. I cannot understand why I am getting a 'No such file or directory' error, when the file is in the folder. Any clues would be much appreciated. Thanks! MJ Here is a copy and paste of the

Re: [Tutor] Python bz2 "IOError: invalid data stream" when trying to decompress

2013-04-10 Thread Dave Angel
On 04/10/2013 08:18 PM, Rodney Lewis wrote: My question is at StackOverflow so I won't repeat it here. http://stackoverflow.com/questions/15938629/python-bz2-ioerror-invalid-data-stream-when-trying-to-decompress Thanks so much in advance for any help you can provide regarding this. http://www.

Re: [Tutor] Create Library

2013-04-14 Thread Dave Angel
On 04/08/2013 09:31 PM, Negin Nayeri wrote: Hi!Im supposed to do a Library in Python and I don't even know how to begin! Please just help me. Like what kind of attributes do you think I should have, how do I store information? The file with the books and authors I must fix, do think I should w

Re: [Tutor] (no subject)

2013-04-14 Thread Dave Angel
On 04/14/2013 08:35 PM, Soliman, Yasmin wrote: Hi everyone. I just need to know why this programs tells me End is not defined, what can I o to fix this issue? Thanks in advance. hrList=[] while True: heartrate= float(input('Enter heart rate as beats per min: ')) hrList.append(heartrat

Re: [Tutor] Hello, and a newbie question

2013-04-16 Thread Dave Angel
On 04/16/2013 11:58 AM, Andy McKenzie wrote: Hey folks. I'm just starting to pick up Python, and I'd like to avoid some of the mistakes I made in the past. To elaborate on that, my primary programming/scripting experience is PHP, with a little bit of Perl thrown in. Like so many people who wri

Re: [Tutor] oops - resending as plain text

2013-04-16 Thread Dave Angel
On 04/16/2013 01:48 PM, Jim Mooney wrote: I accidentally sent as HTML so this is a resend in case that choked the mailing prog ;') I was doing a simple training prog to figure monetary change, and wanted to avoid computer inaccuracy by using only two-decimal input and not using division or mod w

Re: [Tutor] Hello, and a newbie question

2013-04-16 Thread Dave Angel
On 04/16/2013 05:20 PM, Andy McKenzie wrote: Thanks for the advice, folks. Given that it looks like the biggest changes are unicode handling (which I'm not going to need any time soon) and the way the print function works, I decided to stick with 2.7. I'm an IT guy, though unemploye

Re: [Tutor] oops - resending as plain text

2013-04-16 Thread Dave Angel
On 04/16/2013 05:46 PM, Jim Mooney wrote: Further question. If I round the input right at the beginning, round(paid,2) does that mean I still have the original error from using .76 even before math, or does the rounding kill it? I would guess not if it's binary, You guess right. round() funct

Re: [Tutor] Hello, and a newbie question

2013-04-16 Thread Dave Angel
On 04/16/2013 05:47 PM, Andy McKenzie wrote: On Tue, Apr 16, 2013 at 5:31 PM, Dave Angel wrote: To get 3.x functionality, you'd want to use from __future__ import print_function and I do not think that works in 2.6 or older versions. It also can be awkward even in 2.7 if y

Re: [Tutor] How did this decimal error pop up?

2013-04-16 Thread Dave Angel
On 04/16/2013 06:10 PM, Hugo Arts wrote: The other option, and probably the simplest to use, is python's built in decimal module, which provides a special class that implements perfectly accurate decimal calculations. Why don't we use it for all applications, you might ask? Well, it is extre

Re: [Tutor] Sys.argv read parameters

2013-04-17 Thread Dave Angel
On 04/17/2013 03:27 PM, Danilo Chilene wrote: Dear Python Tutor, I have the code below(file.py): import sys a = 'This is A' b = 'This is B' c = 'This is C' for i in sys.argv[1]: if sys.argv[1] == 'a': print a if sys.argv[1] == 'b': print b if sys.argv[1] == 'c

Re: [Tutor] Sys.argv read parameters

2013-04-17 Thread Dave Angel
On 04/17/2013 04:49 PM, Danny Yoo wrote: Wait. If the solution that we're stopping at to use a hashtable here, that's not quite right. Nothing wrong with a dict, if a proper specification of the problem were available. Notice that in my solution, the messages were not all trivially related

Re: [Tutor] Sys.argv read parameters

2013-04-17 Thread Dave Angel
On 04/17/2013 05:15 PM, Danny Yoo wrote: Yup! Sorry about my tone for its stridency. But I just got concerned that the original poster seemed content about turning the chain of if statements into a table definition. To my mind, they're very closely related, data and control. I'm trying to pus

Re: [Tutor] Fwd: Sys.argv read parameters

2013-04-17 Thread Dave Angel
-- Forwarded message -- From: Danilo Chilene Date: Wed, Apr 17, 2013 at 2:17 PM Subject: Re: [Tutor] Sys.argv read parameters To: Danny Yoo Hello Danny, The part that is changing is just the sys.argv[1] The vars will have always the same content. What I don't want is to hav

Re: [Tutor] Sys.argv read parameters

2013-04-17 Thread Dave Angel
On 04/17/2013 08:12 PM, Alan Gauld wrote: On 17/04/13 20:27, Danilo Chilene wrote: import sys a = 'This is A' b = 'This is B' c = 'This is C' for i in sys.argv[1]: if sys.argv[1] == 'a': print a if sys.argv[1] == 'b': print b if sys.argv[1] == 'c': pr

Re: [Tutor] Fwd: Sys.argv read parameters

2013-04-18 Thread Dave Angel
On 04/18/2013 09:21 AM, Danilo Chilene wrote: On Wed, Apr 17, 2013 at 8:21 PM, Dave Angel wrote: -- Forwarded message -- From: Danilo Chilene Date: Wed, Apr 17, 2013 at 2:17 PM Subject: Re: [Tutor] Sys.argv read parameters To: Danny Yoo Hello Danny, The part that is

Re: [Tutor] path directory backslash ending

2013-04-18 Thread Dave Angel
On 04/18/2013 12:45 PM, Jim Mooney wrote: Minor question. I was adding the Py Script directory to the Win 7 Path, and noticed that Python33 ends with a backslash but many directories do not. Is there a difference? Should I use backslash or not preferentially, or doesn't it matter at all? It does

Re: [Tutor] Fwd: Sys.argv read parameters

2013-04-18 Thread Dave Angel
On 04/18/2013 01:14 PM, Danilo Chilene wrote: The following code has little to do with anything that happened before. So you should start a new thread for this new project. Below is the final code: import requests, json, sys r = requests.get('http://napmongo01.cvc.com.br:28017/_sta

Re: [Tutor] Py 3 package maturity - good links

2013-04-21 Thread Dave Angel
On 04/21/2013 12:24 PM, Jim Mooney wrote: On the other hand, from the perspective of "When will the *majority* of publicly-available libraries and packages support Python 3, then the answer is "Right now". The Python 3 Wall of Shame turned mostly green some time ago, and is now known as the Pytho

Re: [Tutor] is there an explicit eof to test in Py 3?

2013-04-21 Thread Dave Angel
On 04/21/2013 09:35 PM, Jim Mooney wrote: I'm reading a book that suggests finding EOF when the readLine == "" But wouldn't that end erroneously on blank lines, that really contain '\n', in which case more lines might follow? What 'empties' are considered equal in Python? I'm coming from ja

Re: [Tutor] Why is my list index going out of range

2013-04-22 Thread Dave Angel
On 04/22/2013 09:47 PM, Jim Mooney wrote: Okay, what am I doing wrong here? I'm generating primes from a list and getting "list index out of range," but since the for loops controls the indexes I don't see how that's happening. I thought it was the list append, but I commented that out and put in

Re: [Tutor] why does this not work

2013-04-23 Thread Dave Angel
On 04/23/2013 03:39 PM, Roelof Wobben wrote: Im trying to learn python by a course at codeacademy. Now I have this code : def shut_down(s): s = s.lower() if s == "yes": return "Shutting down..." elif s == "no" : return "Shutdown aborted!" else: retu

Re: [Tutor] trouble installing library

2013-04-24 Thread Dave Angel
On 04/24/2013 11:18 AM, Lolo Lolo wrote: Microsoft's C/C++ runtime only uses double quotes. So just change it to the following: >> python -c "import googlemaps" Thanks this solved the issue, now another issue has been thrown. Just not my day. after the 1st module error happens, they show

Re: [Tutor] totalViruses[i] /= float(numTrials),

2013-04-24 Thread Dave Angel
On 04/24/2013 10:59 AM, Sydney Shall wrote: //I am a beginner just learning Python. Welcome to the mailing list. I hope you enjoy your experience with Python. I have come across the following usage for the first time. totalViruses[i] /= float(numTrials) Does it mean? ; totalViruses[i

Re: [Tutor] Concatenating numeric data in Python 3.3

2013-04-24 Thread Dave Angel
On 04/24/2013 12:52 PM, sparkle Plenty wrote: What is the best way to concatenate packed numeric data? I am building a message to send to a device and it has a very specific header format and variable length payload. Converting to string, concatenating, and then converting back to numeric intro

Re: [Tutor] totalViruses[i] /= float(numTrials),

2013-04-24 Thread Dave Angel
On 04/24/2013 06:58 PM, Oscar Benjamin wrote: On 24 April 2013 23:41, Alan Gauld wrote: On 24/04/13 20:32, Oscar Benjamin wrote: On 24 April 2013 20:07, Alan Gauld wrote: On 24/04/13 16:52, Dave Angel wrote: Does it mean? ; totalViruses[i] = totalViruses[i]/float(numTrials) As the

Re: [Tutor] what is the meaning of variable e

2013-04-25 Thread Dave Angel
On 04/26/2013 01:45 AM, wang yong wrote: Hi tutors, I am a newb. Please bear with my simple question. If you're new to Python, then any GUI question isn't "simple." But perhaps you're not new to Python, but only to PyQT. I'll qualify my remarks with the statement that I'm not familiar with

Re: [Tutor] sha-256 without using hashlib

2013-04-26 Thread Dave Angel
On 04/26/2013 05:08 AM, Arijit Ukil wrote: I like to implement sha-256 without using implement. It is easy using hashlib as: import hashlib m = hashlib.sha256() m.update("hi") print m.hexdigest() If anybody has pointer on sha-256 implemented without using hashlib library, please share. If yo

Re: [Tutor] symlinking dirs with spaces

2013-04-26 Thread Dave Angel
On 04/26/2013 08:10 AM, mike wrote: Hi all, I wrote a cli script for syncing my music to a USB mass storage device like a phone etc. all it does is it creates a symlink in a dir to whatever folder i pass as an argument via ./addsync DIR . My problem is i'm having trouble dealing with directories

Re: [Tutor] getting TypeError: float() argument must be a string or a number

2013-04-26 Thread Dave Angel
On 04/26/2013 06:57 PM, Rajlaxmi Swain wrote: How can I fix this. I don't see any antecedents for the pronoun. Show us some code, tell us the situation, and show us the full traceback. Otherwise we'd just be paraphrasing the error message. Make sure the argument is a string, or an int,

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