Re: [Tutor] re-initialising shells

2007-12-21 Thread Alan Gauld
"Jim Morcombe" <[EMAIL PROTECTED]> wrote > I have changed qwerty and saved it away. > I have then run my program (F5) and the program acts as > if it is using an old version of qwerty. You need to "reload" the module to pick up the changes. >>> help(reload) Help on built-in function reload in m

[Tutor] Using 'join ' function to create a string

2007-12-21 Thread lechtlr
Hi there, I would like to know what is the best way to create a string object from two different lists using 'join' function. For example, I have X = ['a', 'b', 'c', 'd', 'e'] and Y = [1, 2, 3, 4, 5]. From X and Y, I want to create a string Z = 'a:1, b:2, c:3, d:4, e:5'. Any help would greatly

Re: [Tutor] Using 'join ' function to create a string

2007-12-21 Thread Dave Kuhlman
On Fri, Dec 21, 2007 at 09:33:31AM -0700, Eric Brunson wrote: > lechtlr wrote: > > Hi there, > > > > I would like to know what is the best way to create a string object > > from two different lists using 'join' function. For example, I have X > > = ['a', 'b', 'c', 'd', 'e'] and Y = [1, 2, 3, 4, 5

Re: [Tutor] Using 'join ' function to create a string

2007-12-21 Thread Eric Brunson
lechtlr wrote: > Hi there, > > I would like to know what is the best way to create a string object > from two different lists using 'join' function. For example, I have X > = ['a', 'b', 'c', 'd', 'e'] and Y = [1, 2, 3, 4, 5]. From X and Y, I > want to create a string Z = 'a:1, b:2, c:3, d:4, e:5

Re: [Tutor] Using 'join ' function to create a string

2007-12-21 Thread bob gailer
lechtlr wrote: > Hi there, > > I would like to know what is the best way to create a string object > from two different lists using 'join' function. For example, I have X > = ['a', 'b', 'c', 'd', 'e'] and Y = [1, 2, 3, 4, 5]. From X and Y, I > want to create a string Z = 'a:1, b:2, c:3, d:4, e:5

[Tutor] Cant write new line at end of file append

2007-12-21 Thread dave selby
Hi all, I need to write a newline at the end of a string I am appending to a file. I tried ... journal.write('%s#%s\n' % (jpeg[:-4], self.snap_init[feed])) The text is all there but no new line at the end any idea what I am doing wrong ? ... thought \n would do it. Cheers Dave -- Plea

Re: [Tutor] Using 'join ' function to create a string

2007-12-21 Thread christopher . henk
this works for me. Z=", ".join(["%s:%s" %(a,Y[b]) for b,a in enumerate(X)]) lechtlr <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] 12/21/2007 11:00 AM To tutor@python.org cc Subject [Tutor] Using 'join ' function to create a string Hi there, I would like to know what is the best wa

[Tutor] Python Challenge 2

2007-12-21 Thread David Holland
I did this and got this string :- "i hope you didnt translate it by hand. thats what computers are for. doing it in by hand is inefficient and that's why this text is so long. using string.maketrans() is recommended. now apply on the url" Is that the answer because it does not solve the problem

[Tutor] python CLI parser

2007-12-21 Thread Martin Marcher
Hello, could you have a short review of my CLI package. What it provides is a simple interface to create a "shell". I'll be using it inside a bot I'm writing to manage it. Features: * pluggable commands * works over streams instead of stdin/stdout/stderr so it should be network aware (right?)

[Tutor] Design Outline question for personal project

2007-12-21 Thread jupiejupe
(please forgive the unclear thought process i am still trying to figure out what i need done and the order there of) i am going to set up a network of "zigbee" nodes. when a event such as: motion movement or touch awakens node i want it's alert to the network to trigger a programmed response. wh

[Tutor] Public Python Library Code

2007-12-21 Thread jupiejupe
hello everyone i have just started to learn python, i know a little html, so this is my real first language. i am finding so much wondering advice sharing and tips, (a special nod to alan g. & kent j.) :clap: i am wondering if there is a place a code library. i have spent way to much time window

Re: [Tutor] Design Outline question for personal project

2007-12-21 Thread jupiejupe
jupiejupe wrote: > > so i figure that i need to study as well as python. > > thanks any bits of info helps just an non-cpu kinda guy with a plan. > redefining list: cherrypy: has a mini sever and database so i can use that instead of mysql? Twisted mail? do i have to use

Re: [Tutor] Python Challenge 2

2007-12-21 Thread Alan Gauld
"David Holland" <[EMAIL PROTECTED]> wrote > > "i hope you didnt translate it by hand. thats what computers are > for. > doing it in by hand is inefficient and that's why this text is so > long. > using string.maketrans() is recommended. now apply on the url" > > Is that the answer because it doe

Re: [Tutor] Design Outline question for personal project

2007-12-21 Thread Alan Gauld
"jupiejupe" <[EMAIL PROTECTED]> wrote > i am going to set up a network of "zigbee" nodes. > when a event such as: motion movement or touch awakens node > i want it's alert to the network to trigger a programmed response. > > what i have to figure out is using a database maybe mysql or Yes, and y

Re: [Tutor] Public Python Library Code

2007-12-21 Thread Alan Gauld
"jupiejupe" <[EMAIL PROTECTED]> wrote > i am wondering if there is a place a code library. There are several. For production code look in the standard library and the Python "Cheeseshop" - a place fort contributed modules. And don't forget to read the sample scripts that come with the Python dow

Re: [Tutor] Cant write new line at end of file append

2007-12-21 Thread Tiger12506
- Original Message - From: "dave selby" <[EMAIL PROTECTED]> To: "Python Tutor" Sent: Friday, December 21, 2007 12:03 PM Subject: [Tutor] Cant write new line at end of file append > Hi all, > > I need to write a newline at the end of a string I am appending to a > file. I tried ... > >

Re: [Tutor] Python Challenge 2

2007-12-21 Thread Tiger12506
>I did this and got this string :- > > "i hope you didnt translate it by hand. thats what computers are for. > doing it in by hand is inefficient and that's why this text is so long. > using string.maketrans() is recommended. now apply on the url" > Is that the answer because it does not solve th

Re: [Tutor] python CLI parser

2007-12-21 Thread bob gailer
Martin Marcher wrote: > Hello, > > could you have a short review of my CLI package. > .bz2??? What does that extension mean? (For us Windows folk). Or could you attach a simple zip file? [snip] ___ Tutor maillist - Tutor@python.org http://mail.pyt

Re: [Tutor] python CLI parser

2007-12-21 Thread tezlo
"Martin Marcher" <[EMAIL PROTECTED]> wrote: > Hello, > > could you have a short review of my CLI package. Hi, it looks alright, it's really rather tiny. For one I could do with spaces between functions for the sake of readability. And it would make more sense to check the callback for being a cal

[Tutor] Regular Expression

2007-12-21 Thread Que Prime
I need to pull the highligted data from a similar file and can't seem to get my script to work: Script: import re infile = open("filter.txt","r") outfile = open("out.txt","w") patt = re.compile(r"~02([\d{10}])") for line in infile: m = patt.match(line) if m: outfile.write("%s\n") infile.cl

[Tutor] Regular Expression

2007-12-21 Thread Michael H. Goldwasser
Que, I haven't tested the script, but please note that patt.match(line) will only succeed when the pattern is at the start of the line. Use patt.search(line) if you want to find the pattern anywhere within the line. Based on your desired highlight, you might want to use the pattern, patt = re.c

Re: [Tutor] Regular Expression

2007-12-21 Thread Tiger12506
>I need to pull the highligted data from a similar file and can't seem to >get > my script to work: > > Script: > import re > infile = open("filter.txt","r") > outfile = open("out.txt","w") > patt = re.compile(r"~02([\d{10}])") You have to allow for the characters at the beginning and end too. Tr

Re: [Tutor] Regular Expression

2007-12-21 Thread Michael Langford
You need to pass a parameter to the string in the following line: outfile.write("%s\n" % m.string[m.start():m.end()]) And you need to use m.search, not m.match in the line where you're actually apply the expression to the string m = patt.search(line) --Michael On 12/21/07, Que Prime <[EMAI