[Tutor] Question on re.findall usage

2013-01-28 Thread Dave Wilder
500, Jul 6 2010, 02:54:50) [GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2 Type "help", "copyright", "credits" or "license" for more information. Any ideas? Thanks, Dave ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Question on re.findall usage

2013-01-28 Thread Dave Wilder
corrections and your solution. I used "Rich Text" which is what I thought was recommended by the list gurus at one point. Plain Text it is then. Your response definitely does the trick and I can use that as a base for the future. As per Joel's comme

Re: [Tutor] HELP-Regarding python

2013-01-29 Thread Dave Angel
On 01/30/2013 01:51 AM, Gayathri S wrote: Hi All! I don't know how to read text file in python. If the data values are stored in a text file format, for example(1,30,60,90,120...200) means what i would do for reading it in python. could you just explain it. infile = open

[Tutor] Need to be able to accept Page Down or CTRL-E

2013-01-31 Thread Dave Wilder
before in python. For example, I used the following to send the character. send (chr(27)) However, I have not been able to find the ascii code equivalent to use for PAGE DOWN and the up/down arrow keys. I'm not even sure this is even a python question. Thanks,

Re: [Tutor] Need to be able to accept Page Down or CTRL-E

2013-01-31 Thread Dave Angel
On 01/31/2013 09:43 PM, Dave Wilder wrote: Hello, In a script I am writing, I would like to be able to accept the PAGE DOWN key as an input as well as the arrow keys. Is that possible w/ Python (I am using python 2.7.3 and Linux OS)? If so, could someone point me to documentation on how to

Re: [Tutor] Need to be able to accept Page Down or CTRL-E

2013-01-31 Thread Dave Wilder
>> On 01/31/2013 09:43 PM, Dave Wilder wrote: >> Hello, >> >> In a script I am writing, I would like to be able to accept the PAGE DOWN >> key as an input as well as the arrow keys. >> >> Is that possible w/ Python (I am using python 2.7.3 and Linux

Re: [Tutor] Need to be able to accept Page Down or CTRL-E

2013-01-31 Thread Dave Angel
On 01/31/2013 10:19 PM, Dave Wilder wrote: On 01/31/2013 09:43 PM, Dave Wilder wrote: Hello, In a script I am writing, I would like to be able to accept the PAGE DOWN key as an input as well as the arrow keys. Is that possible w/ Python (I am using python 2.7.3 and Linux OS)? If so

Re: [Tutor] Need to be able to accept Page Down or CTRL-E

2013-02-01 Thread Dave Angel
On 02/01/2013 03:34 AM, Alan Gauld wrote: OTOH if you mean you want to send the page up/down/arrows as the "something" then its a different game and you can do it. In that case you need todo what you did with ESC. The character set your external app uses will determine the codes you send. As

Re: [Tutor] Need to be able to accept Page Down or CTRL-E

2013-02-01 Thread Dave Wilder
-Original Message- From: Tutor [mailto:tutor-bounces+d.wilder=f5@python.org] On Behalf Of Dave Angel Sent: Friday, February 01, 2013 7:38 AM To: tutor@python.org Subject: Re: [Tutor] Need to be able to accept Page Down or CTRL-E On 02/01/2013 03:34 AM, Alan Gauld wrote

Re: [Tutor] Read from large text file, parse, find string, print string + line number to second text file.

2013-02-01 Thread Dave Angel
On 02/01/2013 03:09 PM, Scurvy Scott wrote: Hey all how're things? I'm hoping for some guidance on a problem I'm trying to work through. I know this has been previously covered on this list but I'm hoping it won't bother you guys to run through it again. My basic program I'm attempting to creat

Re: [Tutor] Read from large text file, parse, find string, print string + line number to second text file.

2013-02-01 Thread Dave Angel
On 02/01/2013 04:24 PM, Scurvy Scott wrote: One last question on this topic.. I'd like to call the files and the string form the command line like Python whatever.py STRINGTOSEARCH NEWFILE FILETOOPEN My understanding is that it would be accomplished as such import sys myString = sys.argv[1]

Re: [Tutor] Help

2013-02-01 Thread Dave Angel
On 02/01/2013 08:47 PM, Jack Little wrote: I get this error Traceback (most recent call last): File "C:\Users\Jack\Desktop\python\g.py", line 56, in path1pt1() NameError: name 'path1pt1' is not defined With this amount of code: def simpstart(): global ammo1 global ammo2 glob

Re: [Tutor] pickle.dump yielding awkward output

2013-02-03 Thread Dave Angel
On 02/03/2013 02:26 PM, Spyros Charonis wrote: Hello Pythoners, I am experiencing a strange result with the pickle module when using it to write certain results to a separate file. In short, I have a program that reads a file, finds lines which satisfy some criteria, and extracts those lines, s

Re: [Tutor] pickle.dump yielding awkward output

2013-02-03 Thread Dave Angel
(top-posting and offline response fixed) On Sun, Feb 3, 2013 at 11:07 PM, Dave Angel wrote: On 02/03/2013 02:26 PM, Spyros Charonis wrote: Hello Pythoners, I am experiencing a strange result with the pickle module when using it to write certain results to a separate file. In short, I have

Re: [Tutor] Iterating a dict with an iteration counter? How would *you* do it?

2013-02-04 Thread Dave Angel
On 02/04/2013 12:13 PM, Modulok wrote: List, Simple question: Is there a common pattern for iterating a dict, but also providing access to an iteration counter? Here's what I usually do (below). I'm just wondering if there are other, more clever ways:: data = {'a': "apple", 'b': "banana",

Re: [Tutor] Iterating a dict with an iteration counter? How would *you* do it?

2013-02-04 Thread Dave Angel
On 02/04/2013 12:58 PM, Modulok wrote: Hmm.. no kidding. Well, at least I knew I was over-complicating it. Cheers! -Modulok- Please don't top-post. Another point. I don't currently have Python 3.x installed, but I seem to remember that in Python 3 you can use the dict itself as an iterator

Re: [Tutor] Iterating a dict with an iteration counter? How would *you* do it?

2013-02-04 Thread Dave Angel
On 02/04/2013 06:18 PM, Steven D'Aprano wrote: On 05/02/13 09:26, Dave Angel wrote: Another point. I don't currently have Python 3.x installed, but I seem to remember that in Python 3 you can use the dict itself as an iterator providing both key and value. If I'm right, t

Re: [Tutor] Getting range of a list

2013-02-05 Thread Dave Angel
On 02/05/2013 04:08 PM, Hs Hs wrote: First comment: do NOT post in html, as it frequently messes up indenting. Send your email in text mode, as this is a text mailing list. Compounding that, you apparently are running inside some shell program (pyshell ?) which is doing a further mess.

Re: [Tutor] Getting range of a list

2013-02-05 Thread Dave Angel
On 02/05/2013 04:48 PM, Hs Hs wrote: Thanks Steve. But one question, when I print, I get extra empty lines. How to get rid of them! Thanks again. f = open('test') head = '---' for line in f: line = line.rstrip() #get rid of the trailing newline (and any other whitespace there) if li

Re: [Tutor] recursive function password check

2013-02-06 Thread Dave Angel
On 02/06/2013 09:26 AM, Noriko Tani wrote: Hi Mara, Several suggestions: Put the password in a list, then loop each letter to check if it is a vowel like this No need to make it a list, strings are already iterable. And you don't make it a list in the code, just in the remark above. pa

Re: [Tutor] recursive function password check

2013-02-06 Thread Dave Angel
On 02/06/2013 08:44 AM, Mara Kelly wrote: Hi everyone, trying to write a program that has the user enter a password, checks if it contains any vowels, and if it does prints ' It is false that password(whatever the user enters) has no vowels,' and if it has no vowels prints it is True that pass

Re: [Tutor] How to override getting items from a list for iteration

2013-02-10 Thread Dave Angel
On 02/10/2013 09:32 AM, Walter Prins wrote: Hello, I have a program where I'm overriding the retrieval of items from a list. As background: The data held by the lists are calculated but then read potentially many times thereafter, so in order to prevent needless re-calculating the same value o

Re: [Tutor] How to override getting items from a list for iteration

2013-02-10 Thread Dave Angel
On 02/10/2013 10:10 AM, Dave Angel wrote: On 02/10/2013 09:32 AM, Walter Prins wrote: Hello, I have a program where I'm overriding the retrieval of items from a list. As background: The data held by the lists are calculated but then read potentially many times thereafter, so in ord

Re: [Tutor] associating two objects without ORM and processing a text file

2013-02-10 Thread Dave Angel
On 02/11/2013 12:14 AM, neubyr wrote: I have a text file with each line in following format: Book Name, Author Name, Genre, Publication Date I would like to perform following queries on this file: * Get all books written by an author * Remove all books of an author * Get information about

Re: [Tutor] Truncated urlopen

2013-02-11 Thread Dave Angel
On 02/11/2013 05:58 AM, Válas Péter wrote: Hi tutors, aboard again after a long time. Welcome back. http://..._export.php?mehet=1 is a link which exports me some data in CSV correctly when I click on it in my browser. (It contains personal data, that's why I dotted.) I want to process it dir

Re: [Tutor] help with inch to cms conversion .

2013-02-11 Thread Dave Angel
On 02/11/2013 11:06 AM, Pravya Reddy wrote: Can you please help me with the code. #!/usr/bin/env python """ inchtocm.py """ First, remove that try/except until the code is free of obvious bugs. It's masking where the error actually occurs. Alternatively, include a variable there, and print

Re: [Tutor] associating two objects without ORM and processing a text file

2013-02-11 Thread Dave Angel
On 02/11/2013 01:19 PM, Alan Gauld wrote: On 11/02/13 05:14, neubyr wrote: * How do I associate/relate Book and Author classes so that it will help me in getting information like 'get list of books written by an author'? Data attribute? I woudn't have a separate Author class but, if you

Re: [Tutor] calling and returning functions.

2013-02-11 Thread Dave Angel
On 02/11/2013 03:07 PM, Pravya Reddy wrote: Can you please complete the code. #!/usr/bin/env python """ One function receives a value in inches and returns the equivalent value in cms like cm = 2.54 * in.The other function receives a value in cms and returns the equivalent value in inches like i

Re: [Tutor] associating two objects without ORM and processing a text file

2013-02-12 Thread Dave Angel
On 02/12/2013 12:32 PM, neubyr wrote: On Mon, Feb 11, 2013 at 7:34 PM, Steven D'Aprano wrote: I am not following your comment on opening books file twice in list_by_author method. I have opened it only once and then reading each line while checking for a regex match. Am I missing something?

Re: [Tutor] associating two objects without ORM and processing a text file

2013-02-14 Thread Dave Angel
On 02/14/2013 12:35 PM, Prasad, Ramit wrote: neubyr wrote: I am not sure how to save an object in memory to a file before exiting the program. Any examples or related documentation links would be really helpful. I am guessing it would be using some kind of before teardown method, but not sure

Re: [Tutor] Newbie Here -- Averaging & Adding Madness Over a Given (x) Range?!?!

2013-02-14 Thread Dave Angel
On 02/14/2013 03:55 PM, Michael McConachie wrote: Hello all, This is my first post here. I have tried to get answers from StackOverflow, but I realized quickly that I am too "green" for that environment. As such, I have purchased Beginning Python (2nd edition, Hetland) and also the $29.00 co

Re: [Tutor] associating two objects without ORM and processing a text file

2013-02-14 Thread Dave Angel
On 02/14/2013 04:33 PM, Prasad, Ramit wrote: Dave Angel wrote: On 02/14/2013 12:35 PM, Prasad, Ramit wrote: neubyr wrote: I am not sure how to save an object in memory to a file before exiting the program. Any examples or related documentation links would be really helpful. I am guessing it

Re: [Tutor] New User-Need-Help

2013-02-15 Thread Dave Angel
On 02/15/2013 06:28 PM, Mark Lawrence wrote: On 15/02/2013 22:31, Joel Goldstick wrote: Sorry, you said above python 3. In python 3 raw_input was changed to input. so change that and it will work for you. There are some differences between 2 and 3 that you will need to look out for. Go to th

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 "

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
t that matters. It's so obvious now. Thanks Dave. a namedtuple is probably exactly what you want. I read this as meaning that while tuples themselves are immutable, to effectively modify it I simply delete it and replace it with a new tuple with new values. Another 'Aha!'

[Tutor] 'Last' in Python?

2013-03-10 Thread Dave Friedman
docs hasn't been helpful. (Maybe I'm searching badly?) Insight and pointers appreciated. Thanks, -Dave ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

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.

<    10   11   12   13   14   15   16   17   18   19   >