Re: [Tutor] Finding palindromes in a list

2012-06-08 Thread Dave Angel
On 06/08/2012 10:17 PM, Mike Nickey wrote: > On Fri, Jun 8, 2012 at 7:03 PM, Dave Angel wrote: >> On 06/08/2012 09:46 PM, Mike Nickey wrote: >>> Thanks guys, >>> This time you forgot to include the list in your posting. Easiest way is to do Reply-all. But you've

[Tutor] Subprocess.Popen process seems to be outputting to stdout even though redirected ?

2012-06-10 Thread dave selby
('\n') if out_str.find('ERROR') != -1: print 'GOT YA :)' time.sleep(1) Any ideas anyone ? Cheers Dave -- Please avoid sending me Word or PowerPoint attachments. See http://www.gnu.org/philosophy/no-word-attachments.html __

Re: [Tutor] Subprocess.Popen process seems to be outputting to stdout even though redirected ?

2012-06-10 Thread dave selby
This list is amazing, I scratch my head, think and think then finally post a question, maybe its the act of spelling it out, ps ax showed 2 x 'tail' processes, I am guessing zombies of previous attempts, killed them, all works AOK now On 10 June 2012 10:06, dave selby wrote: > I

Re: [Tutor] While Loop

2012-06-12 Thread Dave Angel
On 06/13/2012 01:29 AM, Andrew Brunn wrote: > Let me preface by saying that I am currently taking my first programming > class; so I have been a "programmer" for just over a week now. > > Here is my question; > > I > am trying to create a while loop that will allow me ask for a username > and pa

Re: [Tutor] Notepad++ question

2012-06-14 Thread Dave Angel
On 06/14/2012 06:18 PM, Alexander Quest wrote: > [Resending because I messed up on last email] > > My question was regarding a piece of boilerplate code: > > if __name__ == '__main__': > main() > > This calls the main function, but I don't understand what the 'if' > statement is doing here. In

Re: [Tutor] (no subject)

2012-06-19 Thread Dave Angel
On 06/19/2012 03:35 PM, Selby Rowley-Cannon wrote: > Mailing list; > I have a small, [for the most part] functioning translation app for > Rydish, a language created for the sole purpose of an RPG. The only problem > is when I enter a word that has not yet been translated, I get this erro

Re: [Tutor] (no subject)

2012-06-19 Thread Dave Angel
On 06/19/2012 06:48 PM, Mark Lawrence wrote: > On 19/06/2012 21:07, Dave Angel wrote: >> On 06/19/2012 03:35 PM, Selby Rowley-Cannon wrote: >>> Mailing list; >>> I have a small, [for the most part] functioning translation >>> app for Rydish, a languag

Re: [Tutor] Sorting tuples

2012-06-20 Thread Dave Angel
On 06/20/2012 07:05 PM, Mike Nickey wrote: > Hey all, > > I'm working through the google classes to increase my python > understanding and I'm stuck on sorting tuples. > What is being asked is to sort tuples based on the second element of > the tuple in ascending order. > > Given a list of non-empt

Re: [Tutor] Generating random alphanumeric codes

2012-06-26 Thread Dave Angel
On 06/26/2012 03:47 PM, Martin A. Brown wrote: > Hello, > > : Would anyone have tips on how to generate random 4-digit > : alphanumeric codes in python? Also, how does one calculate the > : number of possible combinations? > > Here are some thoughts that come to my mind: > > import string >

Re: [Tutor] wordcount.py query

2012-06-27 Thread Dave Angel
On 06/27/2012 07:59 PM, Imran Javeed wrote: > Hello > > I have attempted the wordcount.py exercise and am trying to understand the > logic behind the code. > > Im trying to replay the code on the python cmd line but keep getting this > error > w_count[string] = w_count[string] + 1 > Traceback

Re: [Tutor] Reading file and storing keys

2012-06-27 Thread Dave Angel
On 06/27/2012 08:19 PM, moheem ilyas wrote: > I am working on a problem from a book, Think Python, which I thought would > be fairly easy. The problem is: > > Exercise 11.1. Write a function that reads the words in words.txt and > stores them as keys in a > dictionary. It doesn’t matter what the va

Re: [Tutor] Reading file and storing keys

2012-06-27 Thread Dave Angel
On 06/27/2012 08:38 PM, moheem ilyas wrote: > Thanks. That makes sense, just failed to notice it. Btw, I tried printing > out wordDict and Python became unresponsive. Any ideas > Not without knowing how you tried it. Offhand, the only reason i can think of is that your were testing with a huge f

Re: [Tutor] .get dicionary question (mutability??)

2012-06-29 Thread Dave Angel
On 06/29/2012 11:32 AM, Emile van Sebille wrote: > On 6/29/2012 6:45 AM Albert-Jan Roskam said... >> Hi Steven, >> Thanks for helping me. It makes more sense now. Calling append() on the >> datatype list returns None but calling __add__ on the datatype int >> returns, well, the result. > > I don't

Re: [Tutor] sitecustomize

2012-07-02 Thread Dave Angel
On 07/02/2012 03:17 PM, Ali Torkamani wrote: > Hi, > I'm absolutely newbie, and appreciate your help, I'm using Spyder, some > times it randomly get the following error: The first place I found Spyder was here: https://en.wikipedia.org/wiki/SPYDER which is an anti-aircraft system based partly on

Re: [Tutor] Returning multiple objects from a function

2012-07-02 Thread Dave Angel
On 07/02/2012 10:23 PM, Alexander Q. wrote: > I understand the basics of tuples, but that formulation returned the > following error: > > Traceback (most recent call last): > File "C:\Users\Owner\Desktop\MIT\Sets\Set3.py", line 34, in > list4 = tuplesresult[1] > TypeError: 'NoneType' object

[Tutor] Python and boot sequences

2012-07-04 Thread Dave Wilder
lecting the image to load when prompted during the reboot. I don't know enough about Python yet to know if that is something that Python can be used for or I am barking up the wrong tree. Thank You, Dave ___ Tutor maillist - Tutor@python.org T

Re: [Tutor] Python and boot sequences

2012-07-08 Thread Dave Wilder
mmer a nail in with a wrench. So I'm going to do a little more digging into the switch code and get to a point where a shell script can be run as Alan suggested. Then I'll be back. Thanks all for the replies. Dave -Original Message- From: tutor-bounces+d.wilder=f

Re: [Tutor] confusion about imports

2012-07-09 Thread Dave Angel
On 07/09/2012 11:56 AM, Chris Hare wrote: > So, I have to admit, imports have me really confused. I am trying to break > apart a 10,000+ line single file into various files, one for each class, and > one containing a whole bunch of functions which are used by a lot of classes. > Some of those

Re: [Tutor] str object is not callable

2012-07-10 Thread Dave Angel
On 07/10/2012 10:56 AM, Chris Hare wrote: > This piece of code works: > > Big-Mac:Classes chare$ more tmp.py > import re > > def special_match(string, search=re.compile(r'[^a-zA-Z0-9\.\ > \-\#\$\*\@\!\%\^\&]').search): > #string = string.rstrip() > return not bool(search(string)) Y

Re: [Tutor] Script to collect values from .csv

2012-07-12 Thread Dave Angel
On 07/12/2012 12:29 PM, Emma Knowles wrote: > Hi all, > > > I have a very large .csv (correlationfile, which is 16 million lines > long) which I want to split into smaller .csvs. The smaller csvs > should be created be searching for a value and printing any line > which contains that value - all th

Re: [Tutor] What’s the differences between these two pieces of code ?

2012-07-13 Thread Dave Angel
On 07/07/2012 12:59 AM, redstone-cold wrote: > What’s the differences between these two pieces of code ? > > (1) > > for i in range(1, 7): > > print(2 * i, end=' ') > > > > > > (2) > > for i in range(1, 7): > > print(2 * i, end=' ') > > print() > > > > > > when executed both respe

Re: [Tutor] get columns from txt file

2012-07-14 Thread Dave Angel
On 07/13/2012 05:09 AM, susana moreno colomer wrote: > > > Hi! > I am sorry, but still I don't get it! 1) please don't top-post. Put your new comments AFTER the part you're quoting. Or don't bother quoting, if you think your stuff stands alone. 2) please do a Reply-all, or equivalent. Anyway

Re: [Tutor] passing global variable as argument.

2012-07-16 Thread Dave Angel
On 07/16/2012 07:00 AM, Bala subramanian wrote: > Friends, > I want to define a function that can populate an array by taking its name > (which is defined globally). I defined two empty arrays as follows and a > function that can populate the array. > > REF_F1=np.array([]) > REF_F2=np.array([]) > >

Re: [Tutor] Extracting columns from many files to different files

2012-07-16 Thread Dave Angel
On 07/16/2012 12:58 PM, Joel Goldstick wrote: > On Mon, Jul 16, 2012 at 12:24 PM, susana moreno colomer > wrote: >> They are separated by tabs You're top-posting again. The history of all these other messages is thoroughly obfuscated if you don't follow the convention of adding your remarks AFTER

Re: [Tutor] string to binary and back... Python 3

2012-07-18 Thread Dave Angel
On 07/18/2012 05:07 PM, Jordan wrote: > OK so I have been trying for a couple days now and I am throwing in the > towel, Python 3 wins this one. > I want to convert a string to binary and back again like in this > question: Stack Overflow: Convert Binary to ASCII and vice versa > (Python) >

Re: [Tutor] string to binary and back... Python 3

2012-07-19 Thread Dave Angel
On 07/19/2012 01:41 AM, wolfrage8...@gmail.com wrote: > On Thu, Jul 19, 2012 at 12:16 AM, Dave Angel wrote: > >> >> I don't get the same error you did. I get: >> >> File "jordan.py", line 13 >> test_int = int(str(te

Re: [Tutor] string to binary and back... Python 3

2012-07-19 Thread Dave Angel
On 07/19/2012 03:19 PM, Jordan wrote: > > > OK. I am using one time pads to XOR data, but the one time pads (keys) > are very large numbers, converting them to binary increases their size > exponentially, which allows me to get more XORing done out of a single You want to explain this impossibili

Re: [Tutor] string to binary and back... Python 3

2012-07-19 Thread Dave Angel
On 07/18/2012 05:07 PM, Jordan wrote: > OK so I have been trying for a couple days now and I am throwing in the > towel, Python 3 wins this one. I should have paid more attention to this the first time. Clearly you don't want help. -- DaveA ___ Tut

Re: [Tutor] string to binary and back... Python 3

2012-07-19 Thread Dave Angel
On 07/19/2012 05:55 PM, Prasad, Ramit wrote: >> I am not sure how to answer that question because all files are binary, >> but the files that I will parse have an encoding that allows them to be >> read in a non-binary output. But my program will not use the in a >> non-binary way, that is why I pl

Re: [Tutor] Calling a function does not return what I want it to return

2012-07-19 Thread Dave Angel
On 07/19/2012 06:58 PM, Alexander Q. wrote: > I have this little program that is supposed to calculate how many diagonals > a polygon of x sides has, but it does not return what I have in the > "return" part of the function when I call it. Here is the code: > > def num_diag(var): > ans = 0 > if

Re: [Tutor] Invalid Token Problem

2012-07-19 Thread Dave Angel
On 07/19/2012 08:36 PM, Osemeka Osuagwu wrote: > ... > 99 ninety nine > 100 onehundred > 101 one hundred and one > 102 one hundred and two > 103 one hundred and three > 104 one hundred and four > 105 one hundred and five > 106 one hundred and six > 107 one hundred and seven > 108 > > Traceback (mos

Re: [Tutor] string to binary and back... Python 3

2012-07-19 Thread Dave Angel
You forgot to include the list. So I'm forwarding it now, with new remarks. On 07/20/2012 01:47 AM, wolfrage8...@gmail.com wrote: > On Fri, Jul 20, 2012 at 12:33 AM, Dave Angel wrote: > >> On 07/19/2012 05:55 PM, Prasad, Ramit wrote: >>>> I am not sure how to ans

Re: [Tutor] Flatten a list in tuples and remove doubles

2012-07-28 Thread Dave Angel
On 07/28/2012 07:12 PM, Francesco Loffredo wrote: > Il 28/07/2012 20:41, eryksun wrote: >> On Sat, Jul 28, 2012 at 11:12 AM, Francesco Loffredo >> wrote: >>> I had to study carefully your present and desired lists, and I >>> understood >>> what follows (please, next time explain !): >>> - each 7-t

Re: [Tutor] filelist

2012-08-04 Thread Dave Angel
On 08/04/2012 09:11 PM, richard kappler wrote: > Starting to work through "Programming Computer Vision with Python" in my > -summer of learning python- quest. Congratulations; that's a worthy goal. > As I read through the intro to the PIL > library, I came across the below code. When I read i

Re: [Tutor] Unzip a zipfile, then unzip the zipfiles within the original zip

2012-08-08 Thread Dave Angel
On 08/08/2012 11:34 AM, Ramchandra Apte wrote: > Sorry. This is my first time using a mailing list! Any idea how to send a > message without replying? > > There are several ways to send a message to this list by email, depending on how the message relates to others. If you're starting a new topic

Re: [Tutor] help - SyntaxError: Non-UTF-8 code using python 3

2012-08-08 Thread Dave Angel
On 08/08/2012 11:26 PM, Lily Tran wrote: > Hello; > > > I am getting the following error when I try to run this python program in > eclipse. I am running python 3: > > > File "/Users/lilytran/Desktop/python/Ex_Files_Python_3_EssT/Exercise > Files/class_beginner_python/hw3_2_lab6.py", line 30 >

Re: [Tutor] receiving string from shell

2012-08-09 Thread Dave Angel
On 08/09/2012 10:24 PM, richard kappler wrote: > The summer of intensive learning continues. Working on subprocess today. > I figured out how to send data out, for example to my festival tts engine: > > [code]response = k.respond(input, "richard") > festivalCmd = '(SayText "%s")' % response > sub

Re: [Tutor] Confusion with Python, Bash and Command Prompt

2012-08-09 Thread Dave Angel
On 08/10/2012 12:01 AM, Santosh Kumar wrote: > Hello There, > > We all know that line starting with "#" in Python is a comment. > > We also know that when the first line of any file (with any extension) > has "#!/usr/bin/env bash" and if you make it executable and do > ./filename.ext in the termina

Re: [Tutor] help--- opening csv in different functions

2012-08-10 Thread Dave Angel
On 08/10/2012 06:02 AM, leon zaat wrote: > I am trying to fill a file. > When i am start the leading fuction the file schould be overwriting the , > probarly, existing csv file. > Accoording from keys from different keys in my sql files, information is > collected and written in a other function

Re: [Tutor] Script won't run for no apparent reason

2012-08-10 Thread Dave Angel
On 08/10/2012 03:33 PM, Selby Rowley Cannon wrote: > On 10/08/12 20:07, Joel Goldstick wrote: >> On Fri, Aug 10, 2012 at 2:57 PM, Selby Rowley Cannon >> wrote: >>> On 10/08/12 18:17, Joel Goldstick wrote: On Fri, Aug 10, 2012 at 1:05 PM, Selby Rowley Cannon wrote: > I have written a

Re: [Tutor] Script won't run for no apparent reason

2012-08-10 Thread Dave Angel
On 08/10/2012 03:53 PM, Joel Goldstick wrote: > On Fri, Aug 10, 2012 at 3:33 PM, Selby Rowley Cannon > wrote: >>> >> #!/usr/bin/env python3 >> >> import random >> values = {'a':'d', 'b':'e', 'c':'f', 'd':'g', 'e':'h', 'f':'i', 'g':'j', >> 'h':'k', 'i':'l', 'j':'m', 'k':'n', 'l':'o', 'm':'p', 'n':

Re: [Tutor] Script won't run for no apparent reason

2012-08-10 Thread Dave Angel
On 08/10/2012 04:02 PM, Selby Rowley Cannon wrote: > OK, I have put it back into Python 2.7, and now I get: > Traceback (most recent call last): > File "crypto.py", line 27, in > encrypt() > File "crypto.py", line 7, in encrypt > textInputE.list() > AttributeError: 'str' object has n

Re: [Tutor] pickle problems

2012-08-12 Thread Dave Angel
On 08/12/2012 04:44 AM, Richard D. Moores wrote: > > > One caveat is that I have yet to fix the problem with lines 75-78. > > One thing I'd like to implement is a monitor of the time > factorsOfInteger(n) takes to process some of the 18-digit ints (line > 153). Most are processed within a second

Re: [Tutor] Confusion regarding the 'from' statement

2012-08-14 Thread Dave Angel
On 08/14/2012 04:00 PM, eryksun wrote: > On Tue, Aug 14, 2012 at 2:24 PM, Mazhar Hussain wrote: >> #mod1.py >> from mod2 import test >> test('mod1.py') >> >> #mod2.py >> def countLines(name): >> print len(open(name).readlines()) >> >> def countChars(name): >> print len(open(name).read()) >

Re: [Tutor] (no subject)

2012-08-19 Thread Dave Angel
On 08/19/2012 03:29 PM, Selby Rowley Cannon wrote: > OK, I have some code, and it uses glob.glob('*.py') to find all the > python files in the current directory. > Just thought i'd ask, would: > > glob.glob('C:\*.py') (Windows), or > > glob.glob('/*.py') (*nix) > > find all the python files on the

Re: [Tutor] pickle problems

2012-08-22 Thread Dave Angel
On 08/22/2012 07:32 PM, Richard D. Moores wrote: > > > My code uses gmpy2.is_prime() (lines 79 and 89). is_prime() is VERY fast. You do know that this gmpy2 function is only statistically correct ? it can false positive. I don't know what the probs are, but it uses Miller-Rabin, with a default

Re: [Tutor] pickle problems

2012-08-23 Thread Dave Angel
On 08/23/2012 04:43 AM, Steven D'Aprano wrote: > On Wed, Aug 22, 2012 at 11:39:46PM -0400, Dave Angel wrote: >> On 08/22/2012 07:32 PM, Richard D. Moores wrote: >>> >>> >>> My code uses gmpy2.is_prime() (lines 79 and 89). is_prime() is VERY fast. >&g

Re: [Tutor] Error message...

2012-08-23 Thread Dave Angel
On 08/23/2012 11:33 AM, Victoria Homsy wrote: > > Dear All - sorry to bother you. I just tried to run this program: > > > def isPalindrome(s): > if len(s) <= 1: return True > else: return s[0] == s[-1] and isPalindrome (s[1:-1]) > isPalindrome('aba') > > > However when I run it in terminal it does

Re: [Tutor] better way to write this code

2012-08-23 Thread Dave Angel
On 08/23/2012 02:33 PM, Norman Khine wrote: > Hello, > I have this code (http://pastie.org/4575790) which pulls data from a list > and then modifies some of the values such as the 'yield' entry, which has > entries like: > > 21 > 15 > ≤ 1000 > ≤ 20 > 2.2 - 30 > > so that they are cleaned up. > >

Re: [Tutor] list comprehension, testing for multiple conditions

2012-08-23 Thread Dave Angel
On 08/23/2012 09:11 PM, Pete O'Connell wrote: > Hi, I have tried to simplify things and am running into a bit of trouble. > What i am really trying to do is: Keep all the lines starting with "v " and > then delete those lines whose modulus 5 don't equal zero > > I have written it like this which se

Re: [Tutor] list comprehension, testing for multiple conditions

2012-08-23 Thread Dave Angel
On 08/23/2012 10:34 PM, eryksun wrote: > On Thu, Aug 23, 2012 at 9:39 PM, Dave Angel wrote: >> >>> theGoodLines = [line.strip("\n") for line in lines if "v " == >>> line[0:2]] >> >> Better to use startswith(), since short lines wil

Re: [Tutor] list comprehension, testing for multiple conditions

2012-08-23 Thread Dave Angel
(you replied off-list, so I'm cc'ing the list here, to keep it public) On 08/23/2012 10:42 PM, Pete O'Connell wrote: > On Fri, Aug 24, 2012 at 1:39 PM, Dave Angel wrote: > >> On 08/23/2012 09:11 PM, Pete O'Connell wrote: >>> Hi, I have tried to sim

Re: [Tutor] 2.7.3 Popen argument issues

2012-08-27 Thread Dave Angel
On 08/27/2012 03:52 AM, Ray Jones wrote: > On 08/26/2012 07:12 AM, eryksun wrote: >> > Yes, the Bash call worked (in fact I tried it just prior to sending the > original message just to be sure). > > I guess I'm a bit confused about 'splitting' the arguments. You said > that Python splits argument

Re: [Tutor] Recursion always returns None

2012-08-28 Thread Dave Angel
On 08/28/2012 07:23 AM, Dharmit Shah wrote: > Hello, > > I am trying to do the following : > > 1) Ask user for the length of the word that he'd like to guess (for > hangman game). > 2) Pick a random word from /usr/share/dict/words (which I understand > is not the best choice for hangman). > 3) Call

Re: [Tutor] running more than one python program at the same time

2012-08-28 Thread Dave Angel
On 08/28/2012 07:19 PM, Ben Fishbein wrote: > Stupid question: how do I run a program from the terminal? I've always just > gone to the drop down menu and clicked run to do it in idle. > > Haven't you noticed that the correct method of posting on this forum is to put your remarks AFTER the part yo

Re: [Tutor] understanding pydoc try

2012-08-30 Thread Dave Angel
On 08/30/2012 09:30 AM, John Maclean wrote: > What does the first line from `pydoc try` actually mean? This does not > look like the syntax that one is supposed to use. > > try_stmt ::= try1_stmt | try2_stmt > You're looking at the first of three BNF statements. BNF (Backus Naur Form, or somethin

Re: [Tutor] understanding pydoc try

2012-08-30 Thread Dave Angel
On 08/30/2012 10:43 AM, John Maclean wrote: > On 08/30/2012 03:05 PM, Dave Angel wrote: >> >> > > Thanks. This is a heck of a lot more clearer to me! BNF, huh? Another > set TLA that I don't need to know ;-) > I learned BNF in about 1972. I've used about 3

Re: [Tutor] understanding pydoc try

2012-08-30 Thread Dave Angel
On 08/30/2012 11:26 AM, Steve Willoughby wrote: > On 30-Aug-12 08:22, Dave Angel wrote: >> On 08/30/2012 10:43 AM, John Maclean wrote: >>> On 08/30/2012 03:05 PM, Dave Angel wrote: >>>> >>>> >>> >>> Thanks. This is a heck of a lot mo

Re: [Tutor] Lambda?? Whaaaaat?

2012-08-30 Thread Dave Angel
On 08/30/2012 11:39 PM, Scurvy Scott wrote: > I'm fairly new to python having recently completed LPTHW. While randomly > reading stack overflow I've run into "lambda" but haven't seen an explanation > of what that is, how it works, etc. > Would anyone care to point me in the right direction? lam

Re: [Tutor] List all possible 10digit number

2012-08-31 Thread Dave Angel
On 08/31/2012 09:08 PM, Scurvy Scott wrote: > First of all thank you guys for all your help. The manual is really no > substitute for having things explained in laymans terms as opposed to a > technical manual. > > My question is this- I've been trying for a month to generate a list of all > pos

Re: [Tutor] List all possible 10digit number

2012-08-31 Thread Dave Angel
On 08/31/2012 10:14 PM, Scurvy Scott wrote: > Thanks for the reply. This isn't an assignment per se as I'm just learning > python for my own sake- not in classes or school or what have you. As I said > I'm pretty new to python picking up whatever I can and generators are > something that I haven

Re: [Tutor] List all possible 10digit number

2012-08-31 Thread Dave Angel
On 08/31/2012 10:38 PM, Scurvy Scott wrote: > Now I've got > > A = 10 > I = raw_input("file name> ") > TheFile = open(I, 'w') > > TheFile.truncate > def allten(a): > while a < 99: > a = + 1 > TheFile.write(a) > allten(a) > > The result is: > Open file 'file.t

Re: [Tutor] List all possible 10digit number

2012-08-31 Thread Dave Angel
On 09/01/2012 01:46 AM, Dwight Hutto wrote: > Here's the better function fixed with a return statement I forgot, but > might not be as quick as the pre-built functions already shown: > > def iterToHighNum(increment,high_num): > end_point = 0 > a = [i for i in range(0,increment)] > while

Re: [Tutor] List all possible 10digit number

2012-09-01 Thread Dave Angel
On 08/31/2012 09:08 PM, Scurvy Scott wrote: > First of all thank you guys for all your help. The manual is really no > substitute for having things explained in laymans terms as opposed to a > technical manual. > > My question is this- I've been trying for a month to generate a list of all > pos

Re: [Tutor] making len() and __len__ return a non-int

2012-09-02 Thread Dave Angel
On 09/02/2012 03:06 PM, Albert-Jan Roskam wrote: > Albert-Jan Roskam wrote: > If you're not going to put anything of your own into the reply message, please delete all the context you're not responding to, and then delete the message instead of sending. On the other hand, if the message actuall

Re: [Tutor] Help

2012-09-06 Thread Dave Angel
On 09/03/2012 10:39 AM, Jack Little wrote: >> Ok, I am somewhat new to python, and I am making a text-based RPG. I get a >> weird error with this code: >> >> >> #A Python text-RPG >> #A Jak Production >> #APOC >> global ammo >> global health >> global lives >> global exp >> global food >> ammo=55 >

Re: [Tutor] python 2.7.1

2012-09-06 Thread Dave Angel
On 08/20/2012 12:47 AM, john wrote: > print "hello world" #this is just something to say > > > > > /Users/jonathan/Documents/hello.py > File "", line 1 > /Users/jonathan/Documents/hello.py > ^ > SyntaxError: invalid syntax > > what am i doing wrong? > > > it would help if you showe

Re: [Tutor] Python

2012-09-06 Thread Dave Angel
On 08/19/2012 04:42 PM, Andrew Rosen wrote: > I have a Windows Computer and I'm trying to make a shortcut on my desktop > that will run a program, so I don't have to open up a New Window form Python > Shell and use that to run the program. I can't figure out how to do it, can > you help me? > T

Re: [Tutor] how to print array without adding newline

2012-09-06 Thread Dave Angel
On 08/18/2012 09:17 PM, vickistan wrote: > Hello: I am trying to output an array to another program that takes an array > as input, but the print statement adds a newline. If it were adding to each > individual element, I could solve it easily, but it is adding one at the end > of the array. Is the

Re: [Tutor] how to print array without adding newline

2012-09-06 Thread Dave Angel
On 09/06/2012 09:49 AM, vi...@thepenguin.org wrote: > Thank you for your reply. I understand that it is odd, but my program is > being called from a hubot and returning data to it as well. I have figured > out how to make the changes to get it to output the correct data in the > correct format,

Re: [Tutor] Making big 'uns into little 'uns

2012-09-06 Thread Dave Angel
On 09/06/2012 09:56 AM, Ray Jones wrote: > I have a multiple 'if' expression that I need to drastically reduce in > size, both for readability and to keep errors from creeping in. > > For example, I would like to have the variable 'test' point to the a > location 'grid[rcount-1][ccount-1]' so that

Re: [Tutor] Making big 'uns into little 'uns

2012-09-06 Thread Dave Angel
On 09/06/2012 10:15 AM, Ray Jones wrote: > On 09/06/2012 07:15 AM, Dave Angel wrote: >> On 09/06/2012 09:56 AM, Ray Jones wrote: >>> I have a multiple 'if' expression that I need to drastically reduce in >>> size, both for readability and to keep errors fro

Re: [Tutor] urllib2.urlopen(....., timeout=)

2012-09-07 Thread Dave Angel
On 09/07/2012 11:16 AM, Ray Jones wrote: > 2.7.3 > According to the docs, urlopen has a timeout capability. But it says > that the timeout = '' > > I've tried integers as the timeout value, I've tried floatsit > doesn't complain about my values, but neither does it timeout. Can > anyone point m

Re: [Tutor] Beginner Q: What does the double underscore mean __ ?

2012-09-09 Thread Dave Angel
On 09/09/2012 07:27 AM, Aaron Pilgrim wrote: > Hi, > I was trying to teach myself some python from a book and I have seen > double underscores used. > What does the __ mean and how do I know when to use it? > > for example: > > __name__==’__main__’ > > (source) > Pilgrim, Mark (2009-10-23). Dive In

Re: [Tutor] Beginner Q: What does the double underscore mean __ ?

2012-09-09 Thread Dave Angel
On 09/09/2012 08:16 AM, Aaron Pilgrim wrote: > Thank you for the response! > You're welcome. A couple points of order: please don't top-post. There is a standard here, which makes much more sense than the Microsoft-imposed "put everything backwards" approach. Put your new text AFTER whatever

Re: [Tutor] Help with class in class

2012-09-09 Thread Dave Angel
On 09/09/2012 04:56 PM, leam hall wrote: > self.blue = Button(root, text="Blue", > command=self.change_text_color("blue")) > self.blue.pack(side=LEFT) > self.green = Button(root, text="Green", > command=self.change_text_color("green")) > self.green.pack(side=LEFT) > > To follow up,

Re: [Tutor] Python in Vertica

2012-09-10 Thread Dave Angel
On 09/10/2012 04:49 PM, C.L. Shetline wrote: > > > Python 2.4.3 with Vertica Database on Linux. > > We are migrating from an Informix database to Vertica. We have C code and a > lot of > SQL Stored procedures in our Informix db that are not viable in Vertica. We > are trying > to convert them to

Re: [Tutor] Python in Vertica

2012-09-11 Thread Dave Angel
A couple of points of order: please do a reply-all, or equivalent, so your response goes to the forum, and not just to one person. or you can add tutor@python.org to it, if that seem easier. Also, please don't top-post on the forum, unless you're deleting all context. And you usually shouldn't

Re: [Tutor] convert ascii to binary

2012-09-12 Thread Dave Angel
On 09/12/2012 07:54 AM, Joel Goldstick wrote: > > A couple of thoughts. The section you reference suggests using higher > level modules such as uu. > uu seems to want to read an ascii file and write a uu encoded file. > > I just read the wikipedia article on uuencoding, since I have heard of > i

Re: [Tutor] convert ascii to binary

2012-09-12 Thread Dave Angel
On 09/12/2012 07:20 AM, Aaron Pilgrim wrote: > Hello, > I am trying to write a small program that converts ascii to binary. > > I tried using the python reference library section 18.8 but had > trouble understanding how to make it work. If you supplied a link, we might be able to figure out what s

Re: [Tutor] How to print a variable from an if/else statement

2012-09-12 Thread Dave Angel
On 09/12/2012 12:38 PM, bob gailer wrote: > > > /Python has statements/./ /if // is a ///statement./So is > /def. > > What's with the attempted italics? This is a text mailing list, and the text version of your html message was thoroughly mangled. It'd be much better to just send t

Re: [Tutor] simon game issues

2012-09-13 Thread Dave Angel
On 09/13/2012 10:07 AM, Matthew Ngaha wrote: > Hi guys. my Python tutorial set me a task to recreate a simon game > using livewires. > http://www.youtube.com/watch?v=agUABjGAJww > this is quite long, i understand if you can't help right away > > summary: > i create 4 squared shaped objects(red, blu

Re: [Tutor] index of elements in numpy array

2012-09-13 Thread Dave Angel
On 09/13/2012 04:16 PM, Bala subramanian wrote: > Friends, > I have a 2D matrix (a numpy array) and i am looping over each row in > the matrix. I would like to know how i can find the index of each > element in a while looping a row. Is there any function in numpy. > > Thanks > Perhaps you're aski

Re: [Tutor] Cube root

2012-09-15 Thread Dave Angel
On 09/15/2012 05:28 PM, Amanda Colley wrote: > Ok, I have to get input from a user ('enter a number') and then get the > cube root of that number. I am having trouble with the code to get the > cube root. If anyone can help me solve this I would greatly appreciate it. > ('enter a number') > n=num

Re: [Tutor] All possible 16 character alphanumeric strings?

2012-09-15 Thread Dave Angel
On 09/15/2012 06:50 PM, Scurvy Scott wrote: > Hello again python tutor list. > I have what I see as a somewhat complicated problem which I have no idea > where to begin. I'm hoping you fine folks can help me. > > I'm trying to generate a list of every possible 16 character string > containing only

Re: [Tutor] All possible 16 character alphanumeric strings?

2012-09-15 Thread Dave Angel
On 09/15/2012 10:03 PM, Scurvy Scott wrote: >> >> That list would fill all the PC's on the planet a few billions times. >> The number of items in the list has 25 digits in it. print 32**16 >> >> I actually should've specified that the list I'm trying to create would > not start at say "000

Re: [Tutor] All possible 16 character alphanumeric strings?

2012-09-15 Thread Dave Angel
On 09/15/2012 11:48 PM, aklei...@sonic.net wrote: >> On 09/15/2012 10:03 PM, Scurvy Scott wrote: That list would fill all the PC's on the planet a few billions times. The number of items in the list has 25 digits in it. print 32**16 >> I can't see any reason why it changes anything.

Re: [Tutor] [Semi-OT] Yes or no on using a Graphical IDE?

2012-09-15 Thread Dave Angel
On 09/16/2012 12:48 AM, Wayne Werner wrote: > On Sat, 15 Sep 2012, leam hall wrote: > >> Hey all, not trying to contribute to the flames of one graphical IDE >> over >> another. I'm just trying to figure out if they are worth the learning >> curve? I >> have been doing most of my work in vi and the

Re: [Tutor] All possible 16 character alphanumeric strings?

2012-09-15 Thread Dave Angel
On 09/16/2012 12:05 AM, Dave Angel wrote: > On 09/15/2012 11:48 PM, aklei...@sonic.net wrote: >>> On 09/15/2012 10:03 PM, Scurvy Scott wrote: >>>>> That list would fill all the PC's on the planet a few billions times. >>>>> The number of items

Re: [Tutor] How to run this block of code dozens of times

2012-09-16 Thread Dave Angel
On 09/16/2012 07:56 PM, Scurvy Scott wrote: > scratch that, new code is below for your perusal: > > from Crypto.PublicKey import RSA > import hashlib > > def repeat_a_lot(): > count = 0 > while count < 20: You're kidding, aren't you? while loops are meant for those times when you don't kn

Re: [Tutor] How to run this block of code dozens of times

2012-09-16 Thread Dave Angel
On 09/16/2012 08:56 PM, Scurvy Scott wrote: > On Sun, Sep 16, 2012 at 5:23 PM, Dave Angel wrote: > >> On 09/16/2012 07:56 PM, Scurvy Scott wrote: >>> scratch that, new code is below for your perusal: >>> >>> from Crypto.PublicKey import RSA >

Re: [Tutor] simple random string generator

2012-09-17 Thread Dave Angel
On 09/17/2012 04:09 PM, Matthew Dalrymple wrote: > thanks for everyone that gave me a hand...i think i got most of the program > done... now i just need to time how long it takes to run each anagramSolution > functions to see which one is faster...now i think i might have got it done > but for s

Re: [Tutor] Tutor Digest, Vol 103, Issue 82

2012-09-17 Thread Dave Angel
On 09/17/2012 05:24 PM, Aaron Pilgrim wrote: Why are you replying to a digest? Reply to one of the messages on the thread you're responding to, and it'll get the subject line right. It'll also thread it together. >> Message: 7 >> Date: Mon, 17 Sep 2012 21:34:05 +0530 >> From: Santosh Kumar >>

Re: [Tutor] simple random string generator

2012-09-17 Thread Dave Angel
On 09/17/2012 05:40 PM, Matthew Dalrymple wrote: > > >>> >>> >> >> Did you look for bugs before trying to time it? For example, did you >> intend that it test the sizes from 10 thru 195 in steps of 5, or did you >> intend from 10 to 100, as you stated in your first post? >> >> Would you care to

Re: [Tutor] Input handling?

2012-09-17 Thread Dave Angel
On 09/17/2012 11:11 PM, Scott Yamamoto wrote: > I've been trying to find possible erros with input(such as NameError or > SyntaxError) to handle them with an except clause. however, I've found > that hitting enter/return while prompted without inputting creates some kind > of problem. usern

Re: [Tutor] simple random string generator

2012-09-17 Thread Dave Angel
On 09/18/2012 01:15 AM, Mark Lawrence wrote: > @Matthew Dalrymple I don't know what is happening but that's at least > two messages from you that show precisely nothing, just original > comments from others. Anyone else seeing the same thing? I'm reading > through gmane on Windows Vista with Thun

Re: [Tutor] Input handling?

2012-09-17 Thread Dave Angel
On 09/18/2012 02:12 AM, Steven D'Aprano wrote: > On Tue, Sep 18, 2012 at 12:04:22AM -0400, Dave Angel wrote: >> On 09/17/2012 11:11 PM, Scott Yamamoto wrote: >>> I've been trying to find possible erros with input(such as NameError or >>> SyntaxError) to handl

Re: [Tutor] Passing arguments to & running a python script on a remote machine from a python script on local machine .

2012-09-19 Thread Dave Angel
On 09/19/2012 02:47 PM, ashish makani wrote: > Hi PyTutor Folks > > Here is my situation > > 1. I have two machines. Lets call them *local & remote.* > Both run ubuntu & both have python installed > > 2. I have a python script, *local.py*, running on *local *which needs to > pass arguments ( 3/4 st

Re: [Tutor] Passing arguments to & running a python script on a remote machine from a python script on local machine .

2012-09-19 Thread Dave Angel
On 09/19/2012 03:45 PM, ashish makani wrote: > Thanks a ton for the prompt reply & the great suggestions, Dave. > Please don't top post. In this mailing list, the convention is to put your remarks after the part you're quoting (which usually isn't the entire message).

Re: [Tutor] Understanding cProfile output

2012-09-20 Thread Dave Angel
On 09/20/2012 03:56 PM, Steven D'Aprano wrote: > On 21/09/12 04:58, ranveer raghuwanshi wrote: >> Hi, >> >> I am trying to understand the output of cProfile when run against my >> python >> code. The code is: > [...] >> What the above code does is it counts the number of prime numbers >> less than

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