[Tutor] I need an 'atomic read/ write action'

2007-11-04 Thread Tom
k need doing?' and the 'I'm going to do the task. Please no one else do it!' are atomic(?) and leave no room for mischief in between. Another problem is that the task may fail and need redoing, but I think I can solve that given a solution to the above. Do let me know if m

Re: [Tutor] I need an 'atomic read/ write action'

2007-11-04 Thread Tom
my desktop computer (Vista Task Scheduler looks fancy but doesn't seem to work so well for me) which uses python 2.5? Thanks again. - Hide quoted text - On 05/11/2007, Kent Johnson <[EMAIL PROTECTED]> wrote: > Tom wrote: > > So all my ideas for how to record task x as '

Re: [Tutor] difflib.SequenceMatcher with get_matching_blocks is incorrect

2007-11-05 Thread Tom
Hi, I asked this question last year but got no response. I'm trying to write a program to test someone's typing speed and show them their mistakes. However I'm getting weird results when looking for the differences in longer (than 100 chars) strings: import difflib # a tape measure string (just

[Tutor] making a typing speed tester

2007-11-07 Thread Tom
Hi, I asked this question last year but got no response. I'm trying to write a program to test someones typing speed and show them their mistakes. However I'm getting weird results when looking for the differences in longer (than 100 chars) strings: import difflib # a tape measure string (just m

[Tutor] Little subclass understanding problem

2007-11-15 Thread Tom
I am trying to understand what happens in the following scenario: class Sub_class(Base_class): def __init__(self, data): Base_class.__init__(self, data) as in: # snippet from http://viner.tv/go?set class Set(list): def __init__(self, value = []): list.__init__([]) The l

[Tutor] rss feed reader, but having trouble with unicode

2008-02-26 Thread Tom
I'm trying to write a little rss feed reader, but having trouble with unicode. I would appreciate some help as I feel I'm going round in circles. Even when the save command works, ElementTree won't or vice-versa. You can see what I've been trying from my commented out lines. I think there is a pro

Re: [Tutor] rss feed reader, but having trouble with unicode

2008-02-27 Thread Tom
wrote: > Hello Tom, > > Try doing this: > > xml = unicode(xml, encoding, "ignore") > elem = ElementTree.fromstring(xml.encode("utf8")) > > > > #do stuff with elem... > > > > f

[Tutor] SSH with Python

2008-02-27 Thread Tom
I have a webfaction server (highly recommended btw) and I'm trying to use automate some tasks over ssh but I'm not having much luck with pyssh http://pyssh.sourceforge.net/ . Some of the docs mention methods that don't exist in the version I downloaded, such as pyssh.run. I'm using windows vista

Re: [Tutor] rss feed reader, but having trouble with unicode

2008-02-28 Thread Tom
Yeah I was considering using that. Thanks for the tip. On 28/02/2008, Michael Langford <[EMAIL PROTECTED]> wrote: > feedparser.org also works really well for this sort of thing. Does a > lot of the unicode automagically for you. > >--michael > > > On Wed, F

Re: [Tutor] How to get a script to open a text file with Python?

2008-06-11 Thread Tom
Or this can open most things: import webbrowser webbrowser.open_new('file///' + filename) On 11/06/2008, Alan Gauld <[EMAIL PROTECTED]> wrote: > > "Terry Carroll" <[EMAIL PROTECTED]> wrote > > > > > > > If TextPad is your default txt editor just use > > > os.system("foo.txt") > > > > > > > or os

Re: [Tutor] IDE

2008-06-11 Thread Tom
I use PythonWin and find the Interactive Python Window invaluable. Does anyone know which of the IDE's mentioned above have a similar feature. (I'm on Vista,sorry!) Thanks. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/t

[Tutor] composing one test suite from two test cases

2010-01-10 Thread Tom Roche
uite in python? (FWIW the python version=2.5.2: downlevel, I know, but the box also needs to run ArcGIS.) TIA, Tom Roche ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] composing one test suite from two test cases

2010-01-11 Thread Tom Roche
Tom Roche Sun, Jan 10, 2010 at 10:44 PM >> How to create a single unittest test suite class that runs all >> methods from multiple TestCase classes? Kent Johnson Mon, 11 Jan 2010 06:42:39 -0500 > The supported way to do this is to create a test suite. There is an > ex

[Tutor] Network Socket question

2010-02-20 Thread Tom Green
socket hangs on RECV. Sorry if I am not explaining this correctly. Maybe someone can share with me some papers on writing Windows sockets. Thank you, Tom Green. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http

[Tutor] bind line-oriented device output?

2010-03-28 Thread Tom Roche
de to which one could say, see this device? and this file? Make the device's output go only to that file. For extra credit, don't let anything else write that file while this code is running. Can python do that? Or does one need to get closer to the metal? TIA, Tom Roche _

Re: [Tutor] bind line-oriented device output?

2010-03-29 Thread Tom Roche
control character." Unfortunately when I search the PDF http://tinyurl.com/waspWLS9500manual for "control character" I get no hits. Are there synonyms for that term in this context? TIA, Tom Roche ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

[Tutor] extending a VS python with cygwin

2010-08-09 Thread Tom Roche
...] >or: setup.py --help-commands >or: setup.py cmd --help > error: invalid command 'mingw32' What's the appropriate syntax here? Or how else should I fix this? Apologies if this is a FAQ. If this is the wrong list/forum/whatever for this query, please direct m

[Tutor] Conversion question

2009-05-04 Thread Tom Green
First, thanks in advance for any insight on how to assist in making me a better Python programmer. Here is my question. I work with a lot of sockets and most of them require hex data. I am usually given a string of data to send to the socket. Example: "414243440d0a" Is there a way in Python to

Re: [Tutor] Conversion question

2009-05-04 Thread Tom Green
Thank you, I didn't realize it was that easy. I tried binascii before and I thought it didn't work properly. I appreciate it. Mike. On Mon, May 4, 2009 at 7:40 PM, Emile van Sebille wrote: > On 5/4/2009 4:17 PM Tom Green said... > >> First, thanks in advance for any in

Re: [Tutor] Conversion question

2009-05-05 Thread Tom Green
Thanks everyone for your replies. This reason for the long string is sometimes I have to pass a 32 byte key (MD5 hash value) to the socket. The data I am sending is the hex values i.e. 41=A. I believe the binascii will work. Mike On Mon, May 4, 2009 at 7:52 PM, Alan Gauld wrote: > >

Re: [Tutor] Best Python Editor

2009-06-13 Thread Tom Green
For Windows check out PyScripter. Its IDE is similar to Borland Delphi and I find it very easy to use. Whatever works for you would be "best" for you. PyScripter is FREE and I would highly recommend it for people who are new to Python or people with programming experience that are used to progra

Re: [Tutor] Best Python Editor

2009-06-14 Thread Tom Green
Since VIM seems to be the editor of choice and I have been programming in Python for many years using Pyscripter and Eclipse I was wondering how I could transition away from the IDE world to VIM. My main issue is how do I go about using VIM to debug my code? With Pyscripter and other IDES its as

Re: [Tutor] Best Python Editor

2009-06-15 Thread Tom Green
This has been a great discussion and when I first entered college I was required to take Pascal. At that time we used Turbo Pascal IDE--if you want to call it an IDE. As with anything technology advances and we have new tools for the job and I became spoiled once Visual Studio hit the market. I

Re: [Tutor] Conversion question

2009-06-16 Thread Tom Green
Correct 8-bit ASCII. Sorry about that. I am using Python 2.5.2, which doesn't support bin. If I upgraded how would I go about converting the entire string to 8-bit ASCII? I appreciate your help. On Tue, Jun 16, 2009 at 3:05 PM, Lie Ryan wrote: > xchime...@gmail.com wrote: > > Thanks for th

Re: [Tutor] Conversion question

2009-06-16 Thread Tom Green
Thanks I just happened to find the site myself. I guess I have to pass each character to the function and build the 8-bit ASCII string or is there a better way to do it? On Tue, Jun 16, 2009 at 3:37 PM, Wayne wrote: > On Tue, Jun 16, 2009 at 2:25 PM, Tom Green wrote: > >> Correct

[Tutor] Pack as HEX question

2009-10-24 Thread Tom Green
Hello everyone, First, I wanted to thank everyone in advance for your help and any feedback is appreciated. Here is what I am trying to accomplish: I have this encrypted data that was sent across the network. The decryption is a simple XOR with a 16 byte key. I started writing a basic Python s

Re: [Tutor] Pack as HEX question

2009-10-24 Thread Tom Green
: > > "Tom Green" wrote > > > wondering if there was someway in Python to indicate that the string is a >> string of HEX values similar to Perl's pack. >> > > You need to be very careful in your terminology here. > > Is it "a string of he

Re: [Tutor] Pack as HEX question

2009-10-24 Thread Tom Green
This is what I have so far, import struct EncryptString="313B372C2E2C63362E2128" XorKey="41424344" key = struct.unpack("d", XorKey) num_ints = len(EncryptString)/11 data = struct.unpack("%dd"% num_ints,EncryptString) The above code generates an error the my string must be a string length of 16

Re: [Tutor] Pack as HEX question

2009-10-24 Thread Tom Green
is a better way. Mike On Sat, Oct 24, 2009 at 4:43 PM, Dave Angel wrote: > Tom Green wrote: > >> Alan, >> >> Thanks for your response and hopefully I can clear things up. I apologize >> for not being more clear. >> >> I obtain the HEX encoded data

Re: [Tutor] Pack as HEX question

2009-10-24 Thread Tom Green
Sweet nice tip I love this list. Thank you. Mike On Sat, Oct 24, 2009 at 7:40 PM, Dave Angel wrote: > Tom Green wrote: > >> Thanks for your reply Dave. I am capturing the data off the network >> (wireshark) and saving it in WinHex for testing. I am actually building a &g

[Tutor] Match on current line and next line. Possible?

2005-02-08 Thread Tom Tucker
arch('^Python', line) match_two = re.search('^\tBLAH', line) if match_one and nextline == match_two: do_something() Maybe this just isn't possible, since we are working line by line. Any suggestions? Tom __

[Tutor] Does Python have anything like Perls format output?

2005-04-23 Thread Tom Tucker
Good evening! Does Python have a print function similar to Perl format output (example below)? Thanks Tom format STDOUT = @<<<<< @>>>> @<<<<<<<<<<<<<<<<<<< [EMAIL PROTECTED] [

[Tutor] Is it possible to load variable into a regex string?

2005-04-27 Thread Tom Tucker
Hello all! I am trying to pass a variable to my re.compile string (see broken example below). Is something like this possible? Thanks! regexstring = 'H\sb' textstring = 'BLAH blah' match = re.compile((%s) % (regexstring)) # ? if match.search(line): print

[Tutor] output of dictionaries

2005-05-10 Thread Tom Cloyd
in giving some of your time to this service. I'm very grateful. -- t. ====== Tom Cloyd Bellingham, Washington, U.S.A: (360) 920-1226 << BestMindHealth.com >> == Using Opera's r

[Tutor] Python sort with a delimiter

2005-05-11 Thread Tom Tucker
Good morning! Does Python have a sort function thats supports a delimiter? For example, I want to sort the below hostnames, based on the city. Thanks! Tom Hostnames to be sorted - sys01-xxx-austin-tx sys02-xxx-austin-tx sys01-yyy-austin-tx sys01-xxx

Re: [Tutor] Python sort with a delimiter

2005-05-11 Thread Tom Tucker
Interesting! Thank you! On 5/11/05, Kent Johnson <[EMAIL PROTECTED]> wrote: > Tom Tucker wrote: > > Good morning! Does Python have a sort function thats supports a delimiter? > > For example, I want to sort the below hostnames, based on the city. > > This is easy t

[Tutor] Pickling in plain English

2005-05-24 Thread Tom Tucker
I am having trouble understanding the c|Pickle modules. What does serializing and de-serializing objects mean? I have read the below urls and I "think" I understand the process, but I can't visualize the beneifts. Can someone kindly explain pickling in lamens terms? Than

Re: [Tutor] Pickling in plain English

2005-05-24 Thread Tom Cloyd
me - and singularly useful to my study of Python. To those of you who give your time, thought, and experience here to those of us who need it, thank you so very much. Tom Cloyd On Tue, 24 May 2005 16:32:50 -0700, <[EMAIL PROTECTED]> wrote: > Quoting Tom Tucker <[EMAIL PROTECTED]

Re: [Tutor] Pickling in plain English

2005-05-24 Thread Tom Tucker
John, Thanks that did help. Like usual, I was making it harder than necessary. Tom, I concur! Well put! On 5/24/05, Tom Cloyd <[EMAIL PROTECTED]> wrote: > I just want to take a moment to express my deep appreciation for this > List. As one who is learning Python as amateur,

[Tutor] Covert numbers to hex fails

2005-05-24 Thread Tom Tucker
Good evening! I am trying to pass a number variable and have it converted to hex. Any recommendations on how to achieve this? Thank you. FAILS -- >>> value = 1234567890 >>> hexoutput = hex('%d' % (value)) Traceback (most recent call last): File "", line 1, in ? TypeError: hex() argume

Re: [Tutor] Covert numbers to hex fails

2005-05-24 Thread Tom Tucker
Thanks!I see the mistake. On 5/24/05, Tony Meyer <[EMAIL PROTECTED]> wrote: > > FAILS > > -- > > >>> value = 1234567890 > > >>> hexoutput = hex('%d' % (value)) > > Traceback (most recent call last): > > File "", line 1, in ? > > TypeError: hex() argument can't be converted to hex >

Re: [Tutor] Covert numbers to hex fails

2005-05-25 Thread Tom Tucker
Alan, Thanks! Your response was helpful. I was trying to pass a number variable to the hex object. The output associated with this would be referenced in the hexoutput variable. I guess this is as simple as hexoutput = "%X" % (value) Thanks again for the help, Tom On 5/25/

[Tutor] oops!

2005-05-28 Thread Tom Cloyd
Sorry about that last post! I thought I was replying to a Komodo list post. -- t. == Tom Cloyd Bellingham, Washington, U.S.A: (360) 920-1226 << BestMindHealth.com >> == U

[Tutor] mscvrt module question

2005-06-30 Thread Tom Cloyd
y", line 590, in __init__ execfile(file, globals, locals) File "C:\Documents and Settings\Tom C\My Documents\Python projects - Toms\quiz\quiz.py", line 13, in __main__ KeyIn = getch() NameError: name 'getch' is not defined Also, the interpreter know neither. I

[Tutor] mysterious Python error

2005-07-30 Thread Tom Cloyd
g and reinstalling the ActivePython 2.4.1 Windows package. It didn't change anything at all. Can anyone suggest what I might do with this? Thanks for your help. -- Tom == Tom Cloyd, MS MA, LMHC Private practice Psychotherapist Bellingham,

[Tutor] use of webbrowser.open_new()

2005-08-07 Thread Tom Cloyd
find the file specified: 'C:\\__Library\x0colders*38 Design for Confusion*38 Design for Confusion -05krugman.html' Can you suggest what I might be doing wrong here? -- t. ===

[Tutor] raw string - solution to open_new() problem

2005-08-08 Thread Tom Cloyd
my mind! Now, if anyone can explain why webbrowser.open_new() does the character substitution thing it was doing (and thus becoming unable to locate the file in question), I'm eager to hear it. Meanwhile, I can go ahead with my program. -- t. =====

Re: [Tutor] Multiple lines with the command line

2007-04-16 Thread Tom Tucker
Have you tried the "email" module? http://docs.python.org/lib/module-email.html On 4/16/07, Kharbush, Alex [ITCSV] <[EMAIL PROTECTED]> wrote: I want to use the UNIX Mail program with python I need multiple entries with the os.system(cmd)line I will need something like this #output to uni

Re: [Tutor] Multiple lines with the command line

2007-04-16 Thread Tom Tucker
of', 'my', 'message'] #!/usr/bin/env python import sys message = sys.argv[1:] # save message variable to a file # execute mail command < file On 4/16/07, Tom Tucker < [EMAIL PROTECTED]> wrote: Have you tried the "email" module? http://docs.python.or

Re: [Tutor] version and path

2007-05-14 Thread Tom Tucker
I would use the traditional Unix find command to find the various versions installed. find / -name "python*" On 5/14/07, linda.s <[EMAIL PROTECTED]> wrote: > how to check how many versions of Python i have in my mac machine? > also, how to put the path to the version I desire? > Thanks a lot! >

Re: [Tutor] Web

2007-05-14 Thread Tom Tucker
Jeff, Can you clarify what you are looking to do. You have a small program that you want to distribute via Internet (allow users to view, download, etc)? You want to use Python to create a website? Integrate your program into a web page (modpython for example). On 5/14/07, Jeff Molinari <[EMAIL

Re: [Tutor] version and path

2007-05-14 Thread Tom Tucker
Does this help? On 5/14/07, linda. s <[EMAIL PROTECTED]> wrote: > On 5/14/07, Tom Tucker <[EMAIL PROTECTED]> wrote: > > I would use the traditional Unix find command to find the various > > versions installed. > > > > find / -name "python*"

Re: [Tutor] (no subject)

2007-05-18 Thread Tom Tucker
Very cool! Where is Inky, Blinky, Pinky, and Clyde? ;-) Maybe dog catchers would be better foes for Dusty. On 5/18/07, Teresa Stanton <[EMAIL PROTECTED]> wrote: Hi all: Remember when I was having problems moving my .gif around my Tkinter maze? Well, I was going about it all wrong (as some poi

[Tutor] Continue Matching after First Match

2007-05-18 Thread Tom Tucker
person objectClass: posixAccount objectClass: shadowAccount objectClass: inetorgperson objectClass: organizationalPerson loginShell: /usr/bin/ksh homeDirectory: /home/jtucker dn: uid=ttucker,ou=people,dc=companyA,dc=com loginShell: /usr/bin/zsh host: hostZ host: hostC uid: ttucker cn: Tom Tucker sn: Tu

Re: [Tutor] Continue Matching after First Match

2007-05-18 Thread Tom Tucker
Disregard! Looks like part of my problem is the regex string. On 5/18/07, Tom Tucker <[EMAIL PROTECTED]> wrote: Please forgive the colors, just trying to help illustrate my question. The below code snipet works as designed, however the regex matches once and exits. I want it to co

Re: [Tutor] Continue Matching after First Match

2007-05-21 Thread Tom Tucker
rtin Walsh <[EMAIL PROTECTED]> wrote: Hi Tom, Tom Tucker wrote: > Why the cStringIO stuff? The input data shown below is collected from > os.popen. I was trying to find an easy way of matching my regex. Ah, ldap... Oh yes, Matching with a string seemed easier than looping t

Re: [Tutor] string replacement

2007-05-21 Thread Tom Tucker
One way is... CODE #!/usr/bin/python handle = file("test.txt",'a') number = 1 for num in range(1,5): handle.write("TestingSome%s\n" % (number)) handle.write("something%s-test\n" % (number)) number += 1 handle.close() OUTPUT TestingSome1 something1-

Re: [Tutor] leave tutorial

2007-05-30 Thread Tom Tucker
http://mail.python.org/mailman/listinfo/tutor On 5/30/07, Kriti Satija <[EMAIL PROTECTED]> wrote: i want to leave the tutorial Looking for people who are YOUR TYPE? Find them at in.groups.yahoo.com ___ Tutor maillist - Tutor@python.org http

Re: [Tutor] how can I compare a local directory or file with a remote one

2007-06-20 Thread Tom Tucker
What are we comparing? Size of files, number of files in a directory, md5sum of the files, directory size, etc? What about rsync? You can use rsync to compare directories between a source and destiantion system and just report differences. For example, comparing /etc directores between two RHEL

Re: [Tutor] Regular Expression help

2007-06-27 Thread Tom Tucker
I think I have a solution. File (0012,0042) Clinical Trial Subject Reading ID LO 1 (0012,0050) Clinical Trial Time Point ID LO 1 (0012,0051) Clinical Trial Time Point Description ST 1 (0012,0060) Clinical Trial Coordinating Center Name LO 1 (0018,0010) Contrast/Bolus

Re: [Tutor] how do I input " as part of a string?

2007-07-13 Thread Tom Tucker
Try escaping the quotes. f = open("data.ini","w") f.write("my \"car\" has been a great one for me") f.close() ~ >cat data.ini my "car" has been a great one for me On 7/13/07, elis aeris <[EMAIL PROTECTED]> wrote: also, why does the interpreter restart when I run this? f = open("data.ini"

Re: [Tutor] Simple way to compare Two lists

2007-08-10 Thread Tom Fitzhenry
ove. If neither SmallList or BigList are sorted, it's probably best to use your original method, which I cannot improve. -- Tom Fitzhenry ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Question re Tutor List Etiquette

2007-08-14 Thread Tom Fitzhenry
(7th paragraph, "Now, here's a really useful rule, ...") I don't post that often so I don't get this that often, so it doesn't bother me that much, but I could see how it'd be annoying to those who post frequently. -- Tom Fitzhenry ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] automate daily tasks

2007-09-11 Thread Tom Tucker
Are you looking for a method to automate the execution of your Python program? Is that the question? If yes, have you tried using cron or at jobs (man cron or man at). Tom On 9/11/07, chinni <[EMAIL PROTECTED]> wrote: > > Hi all, > > I am working on MAC OS x my project is

Re: [Tutor] Tutor Digest, Vol 43, Issue 36

2007-09-12 Thread Tom Tucker
d degrade the version and save it and > > run > > updates manually..so,that can any one plz..tell me how to start from > > first > > step... > > > > -- > > Best Regards, > > M.Srikanth Kumar, > > -- next part -- > >

Re: [Tutor] how to add arguments to a command line program

2007-09-14 Thread Tom Tucker
See optparse or sys.argv. On 9/14/07, shawn bright <[EMAIL PROTECTED]> wrote: > > lo there all, > > i want to write a program that will be called from another program. > I need to pass it one variable. > i s

Re: [Tutor] how to match regular expression from right to left

2007-09-16 Thread Tom Tucker
Yep, looks like it. >>> line = 'us::blah blah2 1002 blah3' >>> import re >>> TAG_pattern = re.compile(r"(us::.*) .*(1002|1003).*$") >>> if TAG_pattern.search(line): ... print 'we have a match' ... we have a match >>> >>> line2 ='us::blah blah2 1001 blah3' >>> if TAG_pattern.search(line2): ...

Re: [Tutor] data type conversion for print statement

2007-09-25 Thread Tom Tucker
Excerpt from an email Danny Yoo sent to me and the list in 2005. I had the same question. ;-) Hi Tom, The 'print' statement is hardcoded to add a space between elements. print is meant to make output easy, at the cost of control. If we need more fine-grained control over output, w

Re: [Tutor] killing bash, sshd... dangerous?

2007-10-28 Thread Tom Tucker
Instead of reading in an outputfile (.ps), try reading from command output. The correct terminology escapes me (for file in os.popen(cmd).readlines():). Are you looking for a auto logout method? For example if no activity after X minutes kill the shell. Bash and a few other shells have this func

[Tutor] surprising len() results ???

2005-08-09 Thread Tom Cloyd
client.py", line 1524, in runfile h_execfile(file, args, module=main, tracer=self) File "C:\Program Files\ActiveState Komodo 3.1\dbgp\pythonlib\dbgp\client.py", line 590, in __init__ execfile(file, globals, locals) File "C:\Documents and Settings\Tom C\My Do

Re: [Tutor] surprising len() results ???

2005-08-09 Thread Tom Cloyd
Thanks in advance for any help! Tom C. On Tue, 09 Aug 2005 03:33:11 -0700, Michael Janssen <[EMAIL PROTECTED]> wrote: > On 8/9/05, Tom Cloyd <[EMAIL PROTECTED]> wrote: > >> print len('()ÄäÀÁàáÇçÈÉèéÌÍìíÑñÒÓòóÙÚúù') >> print len('--AaAAaaCcEEeeIIiiNnOOoo

[Tutor] Need Help on Assignment

2005-08-23 Thread Tom Strickland
I have imported a text file consisting of lines of csv. Each line consists of six items separated by commas. I have converted this file into a matrix of string variables, T[i]. Now I want to extract each of the individual strings, convert five them to floats, and save them in individual vectors

Re: [Tutor] IndexError and appending to lists [Was: Re: Need Help on Assignment]

2005-08-23 Thread Tom Strickland
Danny, Thanks for your comments and your help. I've added my comments to your text below. Hopefully it will be in red so you can easily identify them. Tom Danny Yoo wrote: >Hi Tom, > >Before we continue: it looks like you're starting to learn Python. Have >you g

Re: [Tutor] IndexError and appending to lists [Was: Re: Need Help on Assignment]

2005-08-23 Thread Tom Strickland
Danny, I changed the program in accordance with your advice and it now runs perfectly!!! Thanks for the education! Tom Strickland Danny Yoo wrote: >[Danny] > > >>>Anyway, this doesn't answer the problem: how do we add elements to a >>>list? In Python, we c

Re: [Tutor] IndexError and appending to lists [Was: Re: Need Help on Assignment]

2005-08-23 Thread Tom Strickland
Danny, Here's the working program. Tom * #!/usr/bin/python2.4 input = open('/home/tom/Python/Input/SPY3.txt', 'r') N=0 s = 'boo' date =[] T = [0,0,0,0,0,0]

Re: [Tutor] IndexError and appending to lists [Was: Re: Need Helpon Assignment]

2005-08-24 Thread Tom Strickland
tements to verify that the contents of those variables are what I expected them to be. That's all that mess is for. Thanks for your help and Danny's too! Tom Alan G wrote: > Hi Tom, > > Glad you got it working with Danny's help. > > I'll throw in some style poi

Re: [Tutor] IndexError and appending to lists [Was: Re: Need Helpon Assignment]

2005-08-25 Thread Tom Strickland
Alan, Now I understand! Thanks again for the explanation! Alan G wrote: >> "for" loop as you suggest, the program won't enter the loop unless >> "s" is initialized so that it's in "input". How do I do that? > > > for s in input: > > means that s takes on each value in input. > input is your fil

[Tutor] Importing a List from Module

2005-08-27 Thread Tom Strickland
I have a module called "enterData" which generates a list, "close" from a data file. "close" is a list of floats. When I put a print statement in that module it will print out an individual member of the list. For example, print close[0] prints the first member of the list. In my "main"

Re: [Tutor] Importingf a List from Module

2005-08-28 Thread Tom Strickland
Tom Strickland wrote: >>Here are the modules in question: >> >> > This is the main.py module > > #!/usr/bin/python2.4 > import enterData > import movAvg > smavg=[] > xy=enterData.close > print xy[0] > smavg = movAvg.sma(20,enterData.close) >

Re: [Tutor] Importing a List from Module

2005-08-28 Thread Tom Strickland
Byron, I'm confused (as usual). In "def returnList():" that you write below, should the items in the newList list be close[i] and looped to fill "newList" with the contents of "close"? If so, how is "returnLost" different from "close"

Re: [Tutor] Importing a List from Module

2005-08-28 Thread Tom Strickland
Tom Strickland wrote: > Eric, > > No, "xy" isn't used anywhere else in the program. It's just a dummy > variable I used to print out "enterData.close". I could easily have > left it out. > > Tom > > > Eric Walker wrote: > >&g

[Tutor] [Fwd: Re: Importing a List from Module]

2005-08-28 Thread Tom Strickland
Original Message Subject:Re: Importing a List from Module Date: Sun, 28 Aug 2005 16:37:26 -0500 From: Tom Strickland <[EMAIL PROTECTED]> To: tutor@python.org The problem has been solved. It turned out that I made a newbie mistake that had nothing to d

Re: [Tutor] Importing a List from Module

2005-08-29 Thread Tom Strickland
d suggestions. While my use of "open" and "close" as list names apparently didn't cause any problems, it's bad form and I've changed those two names. Tom ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Batch file to detect if Python is installed

2005-09-02 Thread Tom Playford
batch files, and I don't like it very much. Thanks in advance, Tom P.S. I do realise this is a little off topic... It does involve Python and programming... just not programming in Python. ___ Tutor maillist - Tutor@python.org http://mail.

[Tutor] Print Output Location in Windows XP

2005-09-02 Thread Tom Strickland
nting, the output window closes. How do I get the output window to stay open, or where is the output stored? Thanks! Tom Strickland ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Where did those spaces come from?

2005-09-12 Thread Tom Tucker
Tutor, Good evening!    The goal is to parse a simple file and grab column one.  Then print each value horizontally separated by a comma. Why is Python adding a space padding between each value?   Please see below. Thanks ahead of time. INPUT_FILE # unwanted lines removed ##

[Tutor] extentions and osX

2005-10-17 Thread Tom Beale
ython build) runs fine, or is there some problem with the way it is linked. I am using python 2.4.1 on osX 10.4 Thanks Tom. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] i have a question

2006-03-10 Thread Tom Bachik
ok say u want python to ask the user to type a username then password for a game account thats easy but how do u get the information they typed back to you? ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] i need help please read

2006-03-22 Thread Tom Bachik
ok does anyone know how to righ a script were a box pops up then if it goes over a number on the screen it pops up in the box become the input number so you can alter the number that popped up in the box? if you do can you right it and send it to me and  if you cant doit all but know how i can do p

[Tutor] I HAVE A QUESTION

2006-03-25 Thread Tom Bachik
des easygui only demo boxes because thats all i can get it todo ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] stfftime question

2006-07-04 Thread Tom Tucker
Below is an example of me converting a datetime to milliseconds on a Mac running Pythong 2.3.5. The same working code on a Solaris system with Python 2.3.2 fails. Any thoughts? What arguments am I missing? >From my Mac # Python 2.3.5 (#1, Oct 5 2005, 11:07:27) [GCC 3.3 20030304 (A

Re: [Tutor] stfftime question

2006-07-04 Thread Tom Tucker
= time.mktime(t1.timetuple())+(t1.microsecond/1000.) t2tuple = time.mktime(t2.timetuple())+(t2.microsecond/1000.) delta = (t2tuple - t1tuple) * 1000 print delta On 7/4/06, Tom Tucker <[EMAIL PROTECTED]> wrote: > Below is an example of me converting a datetime to milliseconds on a > Mac run

[Tutor] python

2006-08-09 Thread Tom Wilson
could someone explain to me how the "import" function works? tom _ The new Windows Live Toolbar helps you guard against viruses http://toolbar.live.com/?mkt=en-gb ___ Tuto

[Tutor] Roack, Paper Scissors

2006-08-12 Thread Tom Wilson
could someone please explain to me how the scripts for the rock, paper, scissors game work because i'm not quite sure. tom _ Windows Live™ Messenger has arrived. Click here to download it for free! http://imagine-ms

[Tutor] Variable help

2006-10-08 Thread Tom R.
I have a number of arrays: player1 = [data, data, data] player2 = [data, data, data] player3 = [data, data, data] player4 = [data, data, data] I want to be able to do something like: count = 2 if player + count[3] == 5: do this do that count += 1 And that would do this and t

[Tutor] Matching on multiple log lines

2006-10-28 Thread Tom Tucker
I would appreciate any recommendations or assistance on how to read and parse this log. The log is constantly growing and has the potential of being large. For this reason, we are reading in line by line. How do I match on multiple lines, while reading a log line by line. Hopefully the logic e

Re: [Tutor] rsync python script

2008-03-21 Thread Tom Tucker
The success or failure could be confirmed by checking the exit status and/or confirming host77 has the same /var/lib file structure as the source host. The later is the most accurate, however a bit more complicated to confirm. As for determining the reason for failure, possible causes off the top o

Re: [Tutor] int to string

2008-03-21 Thread Tom Tucker
>>> y = 3 >>> type(y) >>> x = str(y) >>> type(x) On Fri, Mar 21, 2008 at 8:05 PM, elis aeris <[EMAIL PROTECTED]> wrote: > how do I convert int to string? > > ___ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor >

Re: [Tutor] append string

2008-03-21 Thread Tom Tucker
Strings are immutable, you can't append to them. How about this >>> mystring = 'Elis' >>> mystring.append('Aeris') Traceback (most recent call last): File "", line 1, in AttributeError: 'str' object has no attribute 'append' >>> mystring + ' Aeris' 'Elis Aeris' >>> x = mystring + ' Aeri

[Tutor] Library for Disk Usage (UNIX)

2008-03-26 Thread Tom Tucker
was looking at os.stat(/path)[WXYZ}, and os.path.getsize, but they are lacking. Thanks for the help, Tom ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

  1   2   >