Re: [Tutor] thesaurus

2009-07-08 Thread Robert Berman
http://pywordnet.sourceforge.net/ This will get you started. This is a tad easier to play with than its newer implementation. Read and experiment. it may meet most of your needs in this arena. Good Luck, Robert On Wed, 2009-07-08 at 18:28 -0400, Pete Froslie wrote: > okay.. I'm get

Re: [Tutor] Python Tutorials: How to create useful programs after learning the syntax?

2009-07-08 Thread Robert Berman
While it is not a sales pitch, the book is excellent. It and the Python Cookbook sit on top of my desk. Both are fantastic and pragmatic reference sources. Robert On Wed, 2009-07-08 at 16:10 -0700, wesley chun wrote: > On Sun, Jul 5, 2009 at 11:48 PM, Luis Galvan wrote: > > Hello all

Re: [Tutor] Searching backwards from end of string

2009-07-10 Thread Robert Berman
ndex into s1 where last occurrence of 'e' is In [37]: ind Out[37]: 5 In [38]: s1[ind] Out[38]: 'e' In [39]: s1 Out[39]: 'abcdeefghijkl' BINGO. Done. Is that not a bit simpler Robert On Fri, 2009-07-10 at 16:24 +0100, Angus Rodgers wrote: > I'm probabl

Re: [Tutor] Searching backwards from end of string

2009-07-10 Thread Robert Berman
On Fri, 2009-07-10 at 20:55 +0100, Angus Rodgers wrote: > On Fri, 10 Jul 2009 11:57:21 -0400, Robert Berman > wrote: > > >I think you are looking for a complex solution. > > Hardly. In my opinion your code w was overly complex for what you were attempting to d

Re: [Tutor] mnemonics to better learn Python

2009-07-31 Thread Robert Lummis
ring its more complex because you have nand and nor gates > to deal with too, but they don't apply in software - at least not directly. > > > -- > Alan Gauld > Author of the Learn to Program web site > http://www.alan-g.me.uk/ > > ___

[Tutor] Tkinter

2009-08-01 Thread Robert Johansson
command line: 'rät'.count('ä') And if I change line 5 to just printing a it works fine to. Anyone who knows how to fix this? Robert ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] noob question (Windows, Python 3.1)

2009-08-06 Thread Robert Berman
gt; that, in future scripts I may be able to actually see what was > printed. I talked to my friend and he said that he has the same > problem...anybody?...help??? > > -- > - JH Hope this helps, Robert > _

Re: [Tutor] Help deciding between python and ruby

2009-09-04 Thread Robert Berman
I think you will get at the least a slight bias toward Python. However, I think you should do your own research and reach your own conclusions. Simply to get you started I put the following into Google: 'Python or Ruby: Which to learn' and got more than 1M hits. Best of luck. Rober

Re: [Tutor] New guy question...

2009-09-14 Thread Robert Berman
work with Version 3. Robert Berman On Mon, 2009-09-14 at 15:30 -0400, Warren wrote: > Hey all, > > I'm just getting started with Python and I'm working my way through my > first "Learn Python" book on my Mac. I ran into a weird issue > though.

Re: [Tutor] how to print a message backwards

2009-09-23 Thread Robert Berman
Is there a significant difference in speed, style, or any pythonesque reasoning between Alan's solution and print message[::-1] Thanks for any information, Robert On Wed, 2009-09-23 at 18:51 +0100, Alan Gauld wrote: > "Ali Sina" wrote > > #Message backward printe

Re: [Tutor] how to print a message backwards

2009-09-23 Thread Robert Berman
Thank you for the clear explanation. Robert On Wed, 2009-09-23 at 23:40 +, ALAN GAULD wrote: > > Is there a significant difference in speed, style, or any pythonesque > > reasoning between Alan's solution and > > print message[::-1] > > > Yes, the for lo

Re: [Tutor] Unknown reason for error.

2009-09-24 Thread Robert Berman
Cory, It would be helpful for us to see the code and the exact error message(s). Would you copy your code and the errors directly to either your post or your code to one of the posting pages such as www.pastebin.org so we can see your code exactly how you have written it. Robert On Thu

Re: [Tutor] Bounces

2009-10-08 Thread Robert Lummis
so I know at > least this one got through!) > > ___ > Tutor maillist  -  tu...@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > > -- Robert Lummis ___ Tutor maillist - Tu

Re: [Tutor] Most pythonic input validation

2009-10-16 Thread Robert Johansson
; Lovely What if a valid user input has to be an integer between 10 and 20? I mean, it could be that you are doing something that only makes sense for that input. Would it be pythonic to add a test like: If prompt in range(10,21): ... else: ... raise

Re: [Tutor] Most pythonic input validation

2009-10-16 Thread Robert Johansson
> What if a valid user input has to be an integer between 10 and 20? I mean, > it could be that you are doing something that only makes sense for that > input. Would it be pythonic to add a test like: > > If prompt in range(10,21): Better to write if 10 <= prompt <= 20: >  ... > else: >  ... ra

Re: [Tutor] Using IDLE v2.6

2009-10-24 Thread Robert Berman
Ken, Two recommendations. 1) Komodo Edit 5. Free edition available from Activestate. www.activestate,com 2) Wing IDE 101 Free Edition from www.wingware.com my favorite of the freely available IDE's. Good luck, Robert On Sat, 2009-10-24 at 13:57 -0400, Ken G. wrote

[Tutor] Sorting points on a 2D plane

2009-10-28 Thread Robert Berman
h. I think there would be a way to build a dictionary but you can't use the X values as keys since keys must be unique. So, any help to point me in a better faster direction will be truly appreciated. Thanks, Robert ___ Tutor maillist - Tuto

Re: [Tutor] Sorting points on a 2D plane

2009-10-29 Thread Robert Berman
n two points is written and working) I will definitely add it to pastebin and ask for your suggestions as well as the suggestions and comments from the group. Again, thank you for your help. Robert ___ Tutor maillist - Tutor@python.org To unsubscri

Re: [Tutor] Sorting points on a 2D plane

2009-10-30 Thread Robert Berman
Hello Shashwat, I have saved the web page for a much more detailed review after I work through the suggestions given by Alan et all. It is obvious that a casual read is not going to be enough. Thank you for the information. Robert On Fri, 2009-10-30 at 23:49 +0530, Shashwat Anand wrote

[Tutor] Accessing variables in main from functions in a module

2009-10-30 Thread Robert Lummis
efined". I understand that it is best to minimize cross-file references but I feel it is warranted in this case. Even if you think it isn't good practice I would like to understand how to do it (or else why it can't be done). Is there some other wa

Re: [Tutor] Accessing variables in main from functions in a module

2009-10-31 Thread Robert Lummis
These replies are great! Thanks to everyone who took the trouble to respond and explain. I'll need some time to digest what you say and put it to use but I'm sure your suggestions will be a huge help. On Fri, Oct 30, 2009 at 7:55 PM, Alan Gauld wrote: > "Robert Lummis" wr

[Tutor] Being beaten up by a tuple that's an integer thats a tuple that may be an unknown 'thing'.

2009-11-03 Thread Robert Berman
have read numerous explanations of this problem thanks to Google; but no real explanation of setting of one element of the pair without setting the second element of the pair as well. For whatever glimmers of clarity anyone can offer. I thank yo

Re: [Tutor] Being beaten up by a tuple that's an integer thats a tuple that may be an unknown 'thing'.

2009-11-03 Thread Robert Berman
Thank you for your explanations and especially your clear examples of a phenomenon(when list elements are tuples) which takes a few moments of study to truly grasp. Robert On Tue, 2009-11-03 at 09:53 -0600, Wayne Werner wrote: > On Tue, Nov 3, 2009 at 9:20 AM, Robert Berman >

[Tutor] Stolen thread: Bottom folk vs. toppers was trouble using 2to3.py

2009-11-03 Thread Robert Berman
lways been incredibly well constructed and concisely and clearly presented. I almost never notice their placement within the post. If there are going to be arguments pertaining to the posts, let them be over content and not placement. Thanks to all who participate in this group. Robert Berman On Tu

Re: [Tutor] Iterating over two sequences in "parallel"

2009-11-28 Thread Robert Johansson
, list2[index] /Robert ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

[Tutor] glpk

2009-11-28 Thread Robert Johansson
work under windows). Is there anyone who can give me an advice or a pointer to more information? /Robert ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

[Tutor] working with bit arrays

2009-12-02 Thread Robert Berman
arrays would be most appreciated. Robert ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] working with bit arrays

2009-12-02 Thread Robert Berman
Wayne, Thank you very much. Robert On Wed, 2009-12-02 at 12:48 -0600, Wayne Werner wrote: > On Wed, Dec 2, 2009 at 12:08 PM, Robert Berman > wrote: > > Hi, > > I am trying to represent a number as a list of bits: for > example the bit

Re: [Tutor] working with bit arrays

2009-12-02 Thread Robert Berman
tance. Robert On Wed, 2009-12-02 at 17:17 -0800, Emile van Sebille wrote: > On 12/2/2009 4:10 PM GilJohnson said... > > > Using an array of 32 bit integers, you have to go to some > > trouble to slice out, say, bits 20 to 40. > > I think I agree -- if in fact it's

Re: [Tutor] Generating Unique Permutations

2009-12-18 Thread Robert Johansson
I think you mean a multiset not a necklace. A necklace is invariant under rotations and reflections aabb=abba=bbaa=baab and abab=baba. Seems that some people name them bags instead of multiset. Maybe this can help you finding more examples? I see that you got a few already. /Robert Från

[Tutor] importing

2009-12-22 Thread Robert Johansson
'method 2: ', time.clock() If I only need the module in one method should I then place it inside that method or keep it outside? class test(): def method1(self): import time print 'method 1: ', time.clock() def method2(self): print &

[Tutor] Finding a repeating sequence of digits

2010-01-01 Thread Robert Berman
know I should use a relatively large precision as repeating values may constitute a rather long sequence. I did see, on Google, a suggestion to use a precision of 1000. Thank you for any and all ideas and suggestions. Robert Berman ___ Tutor

Re: [Tutor] Finding a repeating sequence of digits

2010-01-02 Thread Robert Berman
almost always elucidating and extremely helpful. A number of people have suggested I am attempting a Euler problem. This problem is from the Rosecode series problem 8; http://javaist.com/rosecode/show.php?no=8 Again, thank you for all the suggestions and ideas. Robert Berman

RE: [Tutor] Hi I made a mistake

2004-12-21 Thread Robert, Andrew
Good morning Julias, The python tutor list is a give and take of python information. If can contribute to an explanation or resolve a problem, then please do so. Additionally, you can read the e-mail messages and learn from others on how they handle things. Thank you, Andrew Robert Systems

RE: [Tutor] O.T.

2004-12-29 Thread Robert, Andrew
module called pymqi, http://pymqi.sourceforge.net/, will be the step off point for much of this. Thank you, Andrew Robert Systems Architect Information Technology - OpenVMS Massachusetts Financial Services Phone: 617-954-5882 Pager: 781-764-7321 E-mail: [EMAIL PROTECTED] Linux User Number: #2012

RE: [Tutor] German Totorial!?!

2005-01-05 Thread Robert, Andrew
How about: http://starship.python.net/crew/gherman/publications/tut-de/ Thank you, Andrew Robert Systems Architect Information Technology - OpenVMS Massachusetts Financial Services Phone: 617-954-5882 Pager: 781-764-7321 E-mail: [EMAIL PROTECTED] Linux User Number: #201204 -Original

[Tutor] Active Python

2005-02-16 Thread Robert Campbell
Hi, I am not a programmer, but have decided to learn Python.  I am wondering if anyone has used the Activestate ActivePython and what are the advantages/disadvantages of using it rather than the standard Python tools.   Robert ___ Tutor maillist

[Tutor] big numbers

2005-03-14 Thread Robert Storey
t wondering if this whole issue of big numbers is now being handled automatically? This is my first post - sorry to be asking such a basic question. TIA, Robert ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Problem installing the Pymqi module

2005-04-07 Thread Robert, Andrew
QHOBJ' undeclared (first use in this function) pymqe.c:631: `MQLONG' undeclared (first use in this function) pymqe.c:637: `MQCHAR' undeclared (first use in this function) pymqe.c:640: `qmgrHandle' undeclared (first use in this function) pymqe.c:640: `objHandle' undeclar

[Tutor] Odd problem with variable substitution and command execution

2005-04-13 Thread Robert, Andrew
n the key it is looking for. Variable arg2 successfully forms the q command like you see in the print statement above. When I do the print statement, the value of arg2 is printed instead of being executed. Does anyone know how to get around this problem? Thank you, Andrew Robert Systems Archite

[Tutor] Fastest way to iterate through a file

2007-06-25 Thread Robert Hicks
version whips by) which got me to thinking I could be doing it faster (as I want to move it from Perl to Python). If you need all the code I can post that tomorrow or I can try any ideas posted to this. Thanks! Robert ___ Tutor maillist - Tutor

Re: [Tutor] Fastest way to iterate through a file

2007-06-26 Thread Robert Hicks
Kent Johnson wrote: > Robert Hicks wrote: >> I have a script at work where I have a list of id numbers and I am doing a: >> >> for line in ehFile: > > That is fine > >> for id in line: > > I don't know what this is for - line is a string, i

Re: [Tutor] Fastest way to iterate through a file

2007-06-26 Thread Robert Hicks
Kent Johnson wrote: > Robert Hicks wrote: >> This is the loop code: >> >> for line in f2: >> for id in idList: >> if id in line: >> print "%s: %s" % (id, f2.next()) >> found = "%s: %s" % (id, f

Re: [Tutor] Fastest way to iterate through a file

2007-06-26 Thread Robert Hicks
Kent Johnson wrote: > Robert Hicks wrote: >> idList only has about 129 id numbers in it. > > That is quite a few times to be searching each line of the file. Try > using a regular expression search instead, like this: > > import re > regex = re.compile('|

Re: [Tutor] Fastest way to iterate through a file

2007-06-26 Thread Robert Hicks
Kent Johnson wrote: > Robert Hicks wrote: >> Kent Johnson wrote: >>> Robert Hicks wrote: >>>> idList only has about 129 id numbers in it. >>> That is quite a few times to be searching each line of the file. Try >>> using a regular expression search

Re: [Tutor] Fastest way to iterate through a file

2007-07-01 Thread Robert Hicks
Alan Gauld wrote: > "Robert Hicks" <[EMAIL PROTECTED]> wrote >> This is the loop code: >> >> for line in f2: >> for id in idList: >> if id in line: >> print "%s: %s" % (id, f2.next()) >>

[Tutor] Check if root

2007-09-29 Thread Robert Jackson
I'm trying to write a function that checks to see if the user that is running the python script is 'root' (I'm obviously running this Python program on Linux). Using os.system(), I have done something like this: >>> import os >>> os.system("whoami&

[Tutor] strategy in dealing with user input

2007-09-29 Thread Robert Jackson
I have a few lines of code as follows: CONFIGFILE = raw_input("Enter config location: ") while CONFIGFILE == "": CONFIGFILE = raw_input("You must enter configuration file location: ") Let's say the user hits enter past the initial raw_input request. The user will then be in the whi

[Tutor] linux terminal coloring in python

2007-09-29 Thread Robert Jackson
I'm trying to get some pretty colored output for a Linux console / terminal window. Google searches only reveal the curses module to colorize output. Is there a simpler way? Curses seems to be FAR too powerful for what it is I want to do (simply to colorize a few 'print' outputs to the console

[Tutor] "alias" instance of logger

2007-10-05 Thread Robert Jackson
I'm working with an instance of a Python logger. Some code: log = logging.basicConfig(level=logging.DEBUG,filename="/home/richard/templog",filemode='w') Later in my program I do: log.info("finished step 4.") Python spits out this error: Traceback (most recent call last): File ""

Re: [Tutor] "alias" instance of logger

2007-10-05 Thread Robert Jackson
By the way, I could have SWORN that I've done this successfully in the past in another program. I am relatively certain I have used log.LEVEL() in some of my programs in the past, but I can't figure out how I did it. /r - Original Message ---- From: Robert Jackson <[EMAIL P

[Tutor] python and interface duplex checks

2007-12-12 Thread Robert Recchia
I was wondering can python can be used to check the duplex settings of a network card on a Linux os. -- Robert Recchia ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Spaces and tabs messing up code

2008-01-08 Thread Robert Hicks
[EMAIL PROTECTED] wrote: > my friend uses vim > and i use xemacs > so our shared python code is a mix of tabs and spaces and it is hard for > him to edit it in vim > > any idea on how to make it clean > convert it all to 4 spaces? > > Thanks > :set ts=4 :retab! :h retab ___

Re: [Tutor] functions in Python

2006-04-17 Thread Robert Schumann
efined my function grammar as def kick(): you wouldn't be allowed to tell me *any* of that extra information when you call the function. The return value of the function is the effect it has - for example, assuming the sentence is true, "I kick the ball to Peter" has two effec

[Tutor] Question on option parser

2006-05-16 Thread Andrew Robert
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Everyone, I have a program that I'd would like to enhance flexibility in calling. Is there a way to leverage optionparser so it can accept input from both command line and a configuration file? Current code block is: # # Parse command li

Re: [Tutor] Question on option parser

2006-05-16 Thread Andrew Robert
to") (options, args) = parser.parse_args() print options.qmanager If so, the code generates the following deletion error. Traceback (most recent call last): File "C:\Documents and Settings\Andrew Robert\My Documents\receiver.py", line 326, in ? (options, args) =

[Tutor] Solution found for option parser

2006-05-16 Thread Andrew Robert
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi everyone, Just to be complete, I figured I would share the solution to use option parser for both command line and configuration file option passing. I hope it may be of use to someone in the future. parser = OptionParser() if len(sys.argv) ==

[Tutor] File encoding strategy question

2006-05-20 Thread Andrew Robert
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi everyone, I am in the process of creating a file transmit/receiver program using MQSeries. The way it works is through creation of an XML message. Elements within the XML message contain things such as file name, size, and the file contents. The

[Tutor] Problem with a class

2006-05-22 Thread Andrew Robert
scripts\receiver.py", line 238, in ? test = TriggerMessage.decode(data) TypeError: unbound method decode() must be called by TriggerMessage instance as first argument (got str instance instead) Does this make any sense? The variable data passed to the class is valid and is used elsewhere correctly. - -- Than

Re: [Tutor] problem with class - get message that self is not defined

2006-05-22 Thread Andrew Robert
self.envdata, self.userdata, self.qmgr \ = struct.unpack(format,self.data) - -- Thank you, Andrew Robert Systems Architect Information Technologies MFS Investment Management Phone: 617-954-5882 E-mail: [EMAIL PROTECTED] Linux User Number: #201204 -BEGIN PGP SIGNATURE- Version:

[Tutor] Question on regular expressions

2006-05-24 Thread Andrew Robert
or similar module? I've begun reading about using re expressions at http://www.amk.ca/python/howto/regex/ but I am still hazy on implementation. Any help you can provide would be greatly appreciated. - -- Thank you, Andrew Robert Systems Architect Information Technologies MFS Investment Manag

[Tutor] Hex conversion strangeness

2006-05-24 Thread Andrew Robert
statement but I am not sure why. int(a,16) 33 If the 0X21 is the actual hex value, then why convert to integer? Is this the ASCII table reference to the hex value? - -- Thank you, Andrew Robert Systems Architect Information Technologies MFS Investment Management Phone: 617-954-5882 E-mai

Re: [Tutor] Question on regular expressions

2006-05-24 Thread Andrew Robert
me ; at least in this special case (Python lacks something like the > -l switch). > > With bash it's a bit easier. (maybe there's also a way with cmd.com to > write multiple lines)? > > $ python -c "import re,sys > for line in sys.stdin: print re.sub(r'([^\w\s]

Re: [Tutor] Question on regular expressions

2006-05-25 Thread Andrew Robert
>> >> Not familiar with lamda :). > > You ae absolutely right. > It creates an un-named(or anonymous function). :-) > >> The un-named function does in-place transformation of the character to >> the established hex value. > > Its actually the call

Re: [Tutor] Question on regular expressions

2006-05-25 Thread Andrew Robert
stdout.write() instead of print: > for line i open(r'e:\pycode\sigh.txt','rb'): > line = re.sub(r'([^\w\s])', lambda s: '%%%2X' % ord(s.group()), line) > sys.stdout.write(line) > > Kent > - -- Thank you, Andrew Robert Systems Arc

Re: [Tutor] Question on regular expressions

2006-05-25 Thread Andrew Robert
any chance, do you see where the syntax issue is? Kent Johnson wrote: > Andrew Robert wrote: > Use int(s, 16) to convert a base 16 string to an integer, and chr() to > convert the int to a string. So something like this: > lambda s: chr(int(s.group(), 16))) > > Kent > >

Re: [Tutor] Question on regular expressions

2006-05-25 Thread Andrew Robert
a format string. > > The syntax error is caused by mismatched parentheses. > > Kent > > ___ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > - -- Thank you, Andrew Robert Systems Architect Infor

Re: [Tutor] Question on regular expressions

2006-05-25 Thread Andrew Robert
But I'd also recommend writing a helper function here. Just because you > can do this in one line doesn't mean you have to. *grin* It might be > useful to change the lambda back to a helper function. > - -- Thank you, Andrew Robert Systems Architect Information Techn

Re: [Tutor] Question on regular expressions

2006-05-25 Thread Andrew Robert
. The hex to char pass does not appear to work at all. No error is generated. It just appears to be ignored. Kent Johnson wrote: > Andrew Robert wrote: > > You have an argument in the wrong place. Stop trying to do everything in > one line! Put the lambda in a def'd

Re: [Tutor] Question on regular expressions

2006-05-25 Thread Andrew Robert
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Everyone, Thanks for all of your patience on this. I finally got it to work. Here is the completed test code showing what is going on. Not cleaned up yet but it works for proof-of-concept purposes. #!/usr/bin/python import re,base64 # Eva

Re: [Tutor] How to import a module which was not in the current working directory?

2006-05-26 Thread Andrew Robert
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Linda, You can append your path to include the location of the module. An example of this would be: sys.path.append(r'\\share\somedirectory') linda.s wrote: > Hi, > How to import a module which was not in the current working directory? > Thanks

[Tutor] Python related mags

2006-06-12 Thread Andrew Robert
appears to be defunct. - -- Thank you, Andrew Robert Systems Architect Information Technologies MFS Investment Management Phone: 617-954-5882 E-mail: [EMAIL PROTECTED] Linux User Number: #201204 -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.1 (MingW32) Comment: GnuPT 2.7.2

[Tutor] Odd traceback - invalid token when extracting contents of XML data element

2006-06-12 Thread Andrew Robert
it plays nice with existing perl code already in place. Not my choice, but what can you do. Any help you can provide on this would be greatly appreciated. -- Thank you, Andrew Robert #!c:\python24\python # Program: sender.py # Authors: Andrew Robert and Dariusz Suchojad # # Function: T

Re: [Tutor] Python related mags

2006-06-12 Thread Andrew Robert
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Now that is a real pity. Wish I were talented enough to do it myself. Mike Hansen wrote: > On Jun 12, 2006, at 5:53 AM, Andrew Robert wrote: > >> -BEGIN PGP SIGNED MESSAGE- >> Hash: SHA1 >> >> Hi everyone,

[Tutor] If then else question

2006-06-14 Thread Andrew Robert
f accomplishing the same thing? - -- Thank you, Andrew Robert -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.1 (MingW32) Comment: GnuPT 2.7.2 iD8DBQFEkFgfDvn/4H0LjDwRAophAKCZbJaMWBr2G8dLjHO3VtOA98/+1gCbBsys 4B/Q6g9m+3DW+PzcnCpki6k= =t0E4 -END PGP SIGNATURE-

Re: [Tutor] If then else question

2006-06-14 Thread Andrew Robert
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Excellent.. much better than testing each value independently. Thank you. Mike Hansen wrote: > > >> -Original Message- >> From: [EMAIL PROTECTED] >> [mailto:[EMAIL PROTECTED] On Behalf Of Andrew Robert >>

Re: [Tutor] Universal error handler

2006-06-20 Thread Andrew Robert
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 You may also want to try a error handling like this. It is platform clean and uses the system standard logging routines. import os, logging, logging.handlers def eventlogger(level,message): """ Sent trapped events to NT application

[Tutor] Question regarding commit/backout of a message using the pymqi module

2006-06-22 Thread Andrew Robert
if csums.checksum_compare(sys.argv[0],sum,check,file_name) == True: queue.commit() sys.exit(0) else: queue.backout() mqevlog.event("error","CheckSums of r

Re: [Tutor] How can I add my folder to pythonpath?

2006-06-23 Thread Andrew Robert
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 What you need to do is append your existing path. for example: import sys sys.path.append(r'd:\python_modules') You can then import any modules that reside in that path as if they where part of the standard library. Andy -BEGIN PGP SIGNATURE--

Re: [Tutor] How to check a files size

2006-06-28 Thread Andrew Robert
Perhaps this? stat = os.stat(self.file_name) file_size = stat[6] Thank you, Andrew Robert ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Python module and HP OpenView

2006-07-12 Thread Andrew Robert
there were anything specifically created. Any insight you might have on this would be greatly appreciated. - -- Thank you, Andrew Robert Systems Architect Information Technologies MFS Investment Management Phone: 617-954-5882 E-mail: [EMAIL PROTECTED] Linux User Number: #201204 -BEGIN PGP

[Tutor] Using python to create and save a Ms Word file

2006-07-20 Thread Andrew Robert
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Everyone, I have a text file being broadcast on a web site and I would like to download it and save it as an MS Word file. The download from web is relatively painless. #!C:\Python24\Python import sys from urllib import urlopen if len(sys

Re: [Tutor] Using python to create and save a Ms Word file

2006-07-21 Thread Andrew Robert
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Thanks for your help on this. Here is the completed code in case anyone is interested. #! C:\Python24\python # # program: mswword.py # Author: Andrew Robert # # Ver Date ProgrammerModification # 1.0 07/20/06 AAR

[Tutor] Using python to create and save a Ms Word file

2006-07-21 Thread Andrew Robert
ormat document from it. The program is not platform dependent but it does require installation of the PyRTF module. I hope someone finds this useful/interesting. #!C:\Python24\python # # program: rtfmaker.py # Author: Andrew Robert # # Function: Take a supplied file and dump its contents to an RTF

Re: [Tutor] Rock, Paper, Scissors

2006-08-11 Thread Robert Wierschke
the else part can't have a condition!!! ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Rock, Paper, Scissors

2006-08-12 Thread Robert Wierschke
;: >print "Computer wins!" >computer.points = computer.points + 1 Luke Paireepinart schrieb: > Robert Wierschke wrote: >> the else part can't have a condition!!! >> ___ >> Tutor maillist - Tutor@pyth

Re: [Tutor] [whitelist] Re: regular expressions question

2006-08-22 Thread Andrew Robert
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Nimrodx, In case you haven't found a solution yet, I developed a program to encode/decode stuff similar to this. You may want to take a look at it at http://home.townisp.com/~arobert/python/file_encoder.py nimrodx wrote: > Hi Alan, > > I fou

Re: [Tutor] omnicomplete vim python

2006-08-29 Thread Andrew Robert
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Mike Hansen wrote: > > >> -Original Message- >> From: [EMAIL PROTECTED] >> [mailto:[EMAIL PROTECTED] On Behalf Of Alan Gauld >> Sent: Tuesday, August 29, 2006 1:26 AM >> To: anil maran >> Cc: tutor@python.org >> Subject: Re: [Tutor] omnic

Re: [Tutor] Simple SQL server access...

2006-09-06 Thread Andrew Robert
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Chris Hengge wrote: > I've been doing some searching for ways to access existing SQL server > databases, but I'm finding so many different ways to do it, is there one > that anyone recommends for a "new to python" programmer? I've used VB > and C# for

Re: [Tutor] Simple SQL server access...

2006-09-06 Thread Andrew Robert
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Chris Hengge wrote: > I've been doing some searching for ways to access existing SQL server > databases, but I'm finding so many different ways to do it, is there one > that anyone recommends for a "new to python" programmer? I've used VB > and C# for

Re: [Tutor] Help with parsing

2006-09-18 Thread Andrew Robert
Bryan Leber wrote: > > Hello, I am trying to create a script that reads from the command line > and puts the sysargv into a list. I have this part done. I have added > code for testing and one of those testing procedures is to print the > list out in a text file. Not all field are required and may

[Tutor] Python code to split and reassemble files

2006-10-01 Thread Andrew Robert
to smaller chunks would improve efficiency. - -- Thank you, Andrew Robert Senior MQ Engineer Information Technologies MFS Investment Management Phone: 617-954-5882 E-mail: [EMAIL PROTECTED] Linux User Number: #201204 -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.1 (MingW32) Comment: GnuPT

Re: [Tutor] Python code to split and reassemble files

2006-10-01 Thread Andrew Robert
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Never mind.. :) found it at http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/224800 However, if someone has something better, I would be very interested. Andrew Robert wrote: > Hi guys, > > Awhile back, I believe I saw a cookbo

Re: [Tutor] sending mails from python

2006-10-21 Thread Andrew Robert
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 How about something like this? Create a function and then call it with the required optins of server url, sender address, destination address, subject, and message text? def send(serverURL=None, sender='', to='', subject='', text=''): """ F

[Tutor] pysvn samples

2006-12-15 Thread Andrew Robert
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi guys, I am looking to experiment with pysvn and was wondering if anyone knew of a location for code samples/snippets using it? I'm reviewing the pysvn programmers guide and tutorial but some live examples would be great. If anyone can point me at

[Tutor] Testing the status of NFS mounts

2007-01-04 Thread Andrew Robert
attempt a write on the share and clean up after itself but I am hoping for a more elegant solution. Any insight anyone can provide on this would be greatly appreciated. -- Thank you, Andrew Robert Senior MQ Engineer Information Technologies Massachussetts Financial Services Phone: 617-954-5882

[Tutor] Question on joining out of order dictionary elements

2007-01-10 Thread Andrew Robert
his kind of operation or is this it? The key/value pairs in these examples are contrived for purposes of this discussion but the end goal is to piece together server and directory path information for use with pysvn. I have a Perl programmer who is learning Python and he is griping that this kind

Re: [Tutor] Question on joining out of order dictionary elements

2007-01-11 Thread Andrew Robert
ligent. > > > > Are there a more efficient/compact ways of doing this kind of > > operation or is this it? > > > > Maybe you like: > print "\\".join([config[val] for val in ["val2","val1","val3"]]) > > -- > Andre Engels,

Re: [Tutor] Needed Python 2.5 quick reference.

2007-01-27 Thread Robert Hicks
F version will be great. > > Regards, > Vikram U Shenoy. > I just opened a few of the pdf's from here without a problem: http://rgruet.free.fr/#QuickRef Robert ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] hypotenuse

2008-03-13 Thread Robert Childers
I am in an early lesson in "A Byte of Python." Instead of writing a program to find the area of a rectangle I thought it would be useful to write a program to determine the length of the diagonal of a "golden rectangle", which would of course equal the sq root of the sum of the squares of the widt

<    1   2   3   4   >