Re: [Tutor] A few Python Mysteries [Reset]

2011-12-23 Thread Lie Ryan
On 12/23/2011 03:20 PM, Wayne Watson wrote: Hi, I found it, but not in a place I would expect. It's under my username, Wayne. It is a folder and has three files: breakpoints.lst recent-files.lst ZZrecent-files.lst The last one has the odd ZZ, but is empty. breakpoints.lst is empty too. That c

Re: [Tutor] insert queries into related tables referencing foreign keys using python

2011-12-23 Thread Lie Ryan
On 12/24/2011 11:07 AM, Monte Milanuk wrote: So... most python-sqlite tutorials concentrate on single tables. The few that deal with multiple tables and that mention foreign keys and such seem to demonstrate mainly using hard-coded data instead of parameterized insert queries into tables with au

Re: [Tutor] Python challenge and decryption

2011-12-23 Thread col speed
> That's exactly the point. > Very few people know about maketrans before they take the Python Challenge. > > But that's the whole point of the challenge, as you go through it you will > discover new and powerful tools in the Python library that save you from > having to invent your own. (Look out

[Tutor] insert queries into related tables referencing foreign keys using python

2011-12-23 Thread Monte Milanuk
So... most python-sqlite tutorials concentrate on single tables. The few that deal with multiple tables and that mention foreign keys and such seem to demonstrate mainly using hard-coded data instead of parameterized insert queries into tables with auto-increment primary keys. For the most part I

Re: [Tutor] possibly a version error

2011-12-23 Thread Michael Harleman
> Date: Fri, 23 Dec 2011 14:04:17 +0100 > From: jugurtha.had...@gmail.com > To: tutor@python.org > Subject: Re: [Tutor] possibly a version error > > On 22/12/2011 18:13, Cranky Frankie wrote: > > I got it to work: > > > > Use this for the import - import urllib.request > > > > the use this: dom

Re: [Tutor] Television simulation

2011-12-23 Thread Dave Angel
On 12/23/2011 04:43 PM, Dave Angel wrote: On 12/23/2011 04:21 PM, myles broomes wrote: Im trying to create a 'Television simulation' program. Heres the code ive written for it: #television simulation #a program that simulates a television #the user can turn the television on or off, change the

Re: [Tutor] Television simulation

2011-12-23 Thread Dave Angel
On 12/23/2011 04:21 PM, myles broomes wrote: Im trying to create a 'Television simulation' program. Heres the code ive written for it: #television simulation #a program that simulates a television #the user can turn the television on or off, change the volume or change the channel #create the

[Tutor] Television simulation

2011-12-23 Thread myles broomes
Im trying to create a 'Television simulation' program. Heres the code ive written for it: #television simulation #a program that simulates a television #the user can turn the television on or off, change the volume or change the channel #create the television class class Television(object):

Re: [Tutor] Unable to remove three libs from XP

2011-12-23 Thread Prasad, Ramit
>This is a laugher. The Add/Remove screen was hiding a dialog that >wanted to know if I really wanted to remove the program. Argh. This is why I try and avoid pop-ups when I create a GUI app. Ramit Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology 712 Main Street | Houston

Re: [Tutor] Unable to remove three libs from XP

2011-12-23 Thread Wayne Watson
This is a laugher. The Add/Remove screen was hiding a dialog that wanted to know if I really wanted to remove the program. Argh. On 12/23/2011 4:56 AM, Wayne Watson wrote: I have three py libs and the python program itself, 2.52, installed on an 6 year old HP Laptop. I decided to remove them,

Re: [Tutor] Python challenge and decryption

2011-12-23 Thread Alan Gauld
On 23/12/11 16:58, Joaquim Santos wrote: Thanks for all the tips so far. The maketrans like suggested probably would be faster but I didn't knew about it That's exactly the point. Very few people know about maketrans before they take the Python Challenge. But that's the whole point of the cha

Re: [Tutor] Python challenge and decryption

2011-12-23 Thread Prasad, Ramit
Posting as HTML caused your indentation to be all wrong. Try to post as plain text to remove those errors. Thankfully your program is not very complicated. import string def decrypt(cypheredText, shiftedCypherNumber): ''' This function will take two arguments. The first is the cyphered text,

Re: [Tutor] Python challenge and decryption

2011-12-23 Thread Joaquim Santos
Hi again list! I've been trying to implement the feedback I got. So far, I removed the print statements from the function, limited the range (just for the z at the moment) and tried to get all printing in one or two lines... but without success... I don't know if I'm doing the join as it should...

Re: [Tutor] something relevant to array

2011-12-23 Thread lina
On Fri, Dec 23, 2011 at 8:19 PM, Andreas Perstinger wrote: > On 2011-12-23 12:02, lina wrote: >> >>     for i in range(len(result)): >>         for j in range(len(result[i])): >>             print(result[i][j]) >> >> still have a little problem about print out, >> >> I wish to get like >> a a >> b

Re: [Tutor] possibly a version error

2011-12-23 Thread Jugurtha Hadjar
On 22/12/2011 18:13, Cranky Frankie wrote: I got it to work: Use this for the import - import urllib.request the use this: dom = minidom.parse(urllib.request.urlopen(url)) Here's the code that works in 3.2: from pprint import pprint import urllib.request from xml.dom import minidom WEATHER_U

[Tutor] Unable to remove three libs from XP

2011-12-23 Thread Wayne Watson
I have three py libs and the python program itself, 2.52, installed on an 6 year old HP Laptop. I decided to remove them, and removed Python with the Control Panel Add/Remove icon. Worked fine. When I tried to remove any of the remaining libs, press the add/remove button does nothing but blink.

Re: [Tutor] something relevant to array

2011-12-23 Thread Andreas Perstinger
On 2011-12-23 12:02, lina wrote: for i in range(len(result)): for j in range(len(result[i])): print(result[i][j]) still have a little problem about print out, I wish to get like a a b b c c which will show in the same line, not as a b c a b c So you wish to print a

Re: [Tutor] something relevant to array

2011-12-23 Thread Asokan Pichai
On Fri, Dec 23, 2011 at 3:31 PM, lina wrote: > > Hi, > [SNIPPED] > 2] I want to combine a series of files like > > a.txt > > 1 a > 2 a > 3 a > > b.txt > > 1 b > 2 b > 3 b > > into one as: > a b > a b > a b > Is this ok? ---

Re: [Tutor] something relevant to array

2011-12-23 Thread Alan Gauld
On 23/12/11 11:02, lina wrote: for i in range(len(result)): for j in range(len(result[i])): print(result[i][j]) You don't need all the indexing. Use Pythons for loop to get the items: for group in result: for item in group: print item, # comma prevents

Re: [Tutor] something relevant to array

2011-12-23 Thread lina
#!/usr/bin/python3 import os INFILEEXT = ".xvg" NUM_OF_FILES = 2 if __name__=="__main__": result = [ [] for i in range(NUM_OF_FILES)] for i in range(NUM_OF_FILES): filename = "A_mindist_" + str(i+1) + INFILEEXT #text = open(filename,"r").readlines() with open(fi

Re: [Tutor] something relevant to array

2011-12-23 Thread lina
On Fri, Dec 23, 2011 at 6:42 PM, Alan Gauld wrote: > On 23/12/11 10:01, lina wrote: > >>         with open(filename,"r") as f: >>             for line in f: >>                 parts = f.readline().strip() > > > Are you sure you want to do this? > You are already reading a line from the file in the

Re: [Tutor] something relevant to array

2011-12-23 Thread Alan Gauld
On 23/12/11 10:01, lina wrote: with open(filename,"r") as f: for line in f: parts = f.readline().strip() Are you sure you want to do this? You are already reading a line from the file in the for loop. This will read the next line. So parts will comprise e

Re: [Tutor] something relevant to array

2011-12-23 Thread Rich Lovely
On 23 December 2011 10:01, lina wrote: > Hi, > > 1] How to input some column in idle > > like: > > a > a > a > > 2] I want to combine a series of files like > > a.txt > > 1 a > 2 a > 3 a > > b.txt > > 1 b > 2 b > 3 b > > into one as: > a b > a b > a b > > The work-in-progress code as following, >

Re: [Tutor] list mail formatting

2011-12-23 Thread Steven D'Aprano
Alexander Etter wrote: Ah I know of what you mentioned. On an GNU Emacs mailing list I was advised to avoid anything but plaintext. It just seems so archaic. But I'm a novice and will learn why eventually. There's a number of reasons. In no particular order, and in all cases "you" is generic

[Tutor] something relevant to array

2011-12-23 Thread lina
Hi, 1] How to input some column in idle like: a a a 2] I want to combine a series of files like a.txt 1 a 2 a 3 a b.txt 1 b 2 b 3 b into one as: a b a b a b The work-in-progress code as following, #!/usr/bin/python3 import os INFILEEXT = ".xvg" NUM_OF_FILE = 10 if __name__=="__main_