Re: [Tutor] decimal precision

2008-03-25 Thread bob gailer
ng to look like you are one of those. -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Problem with logic while extracting data from binary file

2008-03-25 Thread bob gailer
t "RT Plan Label\t\t\t\t=\t%s" %RTPlanLabel print "DoseReference Description\t\t=\t%s" %DoseReferenceDescription print "Tolerance Table Label\t\t\t=\t%s" %ToleranceTableLabel print "Number Of Beams\t\t\t\t=\t%i

Re: [Tutor] Problem with logic while extracting data from binary file

2008-03-26 Thread bob gailer
Please always reply to the list not just me. Bryan Fodness wrote: > > Thanks Bob, > > I was having trouble with that loop from the start. Could you tell me > what a=3 is doing, I cannot seem to figure it out. I accidentally left that in. It was a place for me to set a bre

Re: [Tutor] Problem with logic while extracting data from binary file

2008-03-27 Thread bob gailer
bly require another while loop. Do you use a debugger? It has been very helpful to me in tracking down the problem. What operating system are you running? What IDE or development tool are you using? [snip] -- Bob Gailer 919-636-4239 Chapel Hill,

Re: [Tutor] Problem with logic while extracting data from binary file

2008-03-27 Thread bob gailer
Bryan Fodness wrote: > > I have not used a debugger yet, I was getting ready to try that. I am > using IDLE on Windows Vista. > Ah. May I recommend Python for Windows. The debugging support is excellent. I prefer it to IDLE. http://sourceforge.net/projects/pywin32/ -- Bob Ga

Re: [Tutor] Newb Learning Question

2008-04-02 Thread bob gailer
on. So, I suggest you write a program to: assign a candidate string to a variable (choose a string that has at least one letter that "comes after 'm'") test each character to see if it "comes after 'm'" print that character stop Do as much as you can, and ask more questions. -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Newb Learning Question

2008-04-02 Thread bob gailer
> > OR > > b) see if the ascii value of your character is bigger > than the ascii value of 'm' And you can check the > ascii value using ord() > 3rd alternative: if c > 'm': print c > There are pros and cons to both approaches. > Pick the one you

Re: [Tutor] Which Python Script Editor of Choice?

2008-04-03 Thread bob gailer
; My run time environment is IDLE. It is more accurate to say "My development environment is IDLE." The underlying Python interpreter is the runtime. -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Which Python Script Editor of Choice?

2008-04-03 Thread Bob Gailer
[snip] > I went to the PSPad site, but found no way to download the editor. Am > I missing something? Ignore that. Something on the home page did not display correctly. Refresh fixed that. -- Bob Gailer 919-636-4239 Chapel Hill, NC ___

Re: [Tutor] Google App Engine

2008-04-09 Thread bob gailer
t; them in the python code. Seems ugly. Would be nice also to see support for GWT (and pyjamas). -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Copy script

2008-04-09 Thread bob gailer
. It would have been even nicer if he/she had given the specification the first time. Would have saved everyone time and helped ensure a quick and correct answer. -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] List comprehensions

2008-04-10 Thread bob gailer
sent from the server to a browser one result line at a time) > > Any savings you have from optimizing this loop will be completely > swamped by the network time. Why do you think this is a bottleneck? > > You could use > [ sys.stdout.write(some operation o

Re: [Tutor] hey, a bit of a noob at python ut a question about animation...

2008-04-12 Thread bob gailer
e evidence? So does anyone know the command to show after an animation is over??? Show what? ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Bob Gailer 919-636-4239 Chapel Hill, NC

Re: [Tutor] in-memory pysqlite databases

2008-04-12 Thread bob gailer
d to create all the tables in memory, then run select cursors to retrieve from the file-based db and insert the rows into the memory-based db tables Why do you want it in memory? [snip] -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] in-memory pysqlite databases

2008-04-13 Thread bob gailer
m their customers. -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] datetime module problem

2008-04-15 Thread bob gailer
t be a better way. What is it? You might read the datetime documentation. And then notice that date2 - date1 is a timedelta object. And then look that up to see its attributes (which inculdes days) And then try print (date2 - date1).days -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Test - please ignore

2008-04-15 Thread bob gailer
Just testing as recently I'm not seeing my posts even though Receive your own posts to the list? is Yes. -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Help with tutor@python.org

2008-04-16 Thread bob gailer
I just changed my email address. Now when I post to tutor@python.org the posts do not show up. I have checked the mailman settings; they look OK. Have you any guidance? Did this post show up on the list? -- Bob Gailer 919-636-4239 Chapel Hill, NC

Re: [Tutor] Help with tutor@python.org

2008-04-16 Thread bob gailer
Thanks to all. My posts do show up. Now how to get them sent to me??? -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] HELP!!!!!

2008-04-17 Thread bob gailer
man): > if iwon !=tie: > print iwon, "you win!" > else: > print "a tie" > > def main(): > computer, human = pieces() > turn = X > board = newboard() > createboard(board) > > while not winner(board): > if turn == human: > move = humanmove(board, human) > board[move] = human > else: > move = computermove(board, computer, human) > board[move] = computer > createboard(board) > turn = whoseturn(turn) > > iwon = winner(board) > whowon(iwon, computer, human) > > > main() > > > > ___ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > > -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] web programming tutorials?

2008-04-18 Thread bob gailer
a look at the itools.web examples. I was OK with 13.1 Hello world. Then I hit 13.2 Traversal. The text on the page leaves me hopelessly lost. Is there any other explanation? -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@

Re: [Tutor] Executing from Python prompt

2008-04-19 Thread bob gailer
enter an expression at the interactive prompt you see the value. Not true when you run a program. Expression values must be printed. So you are doing nothing wrong. -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Computing factorial...

2008-04-21 Thread bob gailer
ys be 1. Is that not obvious? Or are you expecting that product and temp both refer to the same object? Which would be true if the object were a mutable such as a list or a dict or a class instance. But is NOT the case for immutables such as numbers and strings. -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] HTML Parsing

2008-04-21 Thread bob gailer
for lineno, line in enumerate(html[lineno+1:]): x = line.find("requests currently being processed") if x >= 0: no_connections = line[3:x] That makes certain assumptions about the file format, such as the matching text and knowing that connections follows requests/sec, and does not assume that connections is the first line after requests/sec. -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] HTML Parsing

2008-04-21 Thread bob gailer
x = html[lineno].find("requests/sec") if x >= 0: no_requests_sec = html[lineno].[3:x] break for lineno in range(lineno, len(html)): x = html[lineno].find("requests currently being processed") if x >= 0: no_connections = html[linen

Re: [Tutor] knowing when a list is updated by a thread

2008-04-23 Thread bob gailer
help me understand this". Even the sample code is confusing. Is there some other documentation or example? -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Using Queue

2008-04-23 Thread bob gailer
Kent Johnson wrote: On Wed, Apr 23, 2008 at 9:46 AM, bob gailer <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote: Evey time someone recommends Queue I think "oh boy this will really help me". Then I go to the Library Reference, read the Queue docs and thin

Re: [Tutor] Help with Recurring Function

2008-04-25 Thread bob gailer
%s is %s and %s' % (i, j, norm_ted) sum_norm_ted = sum_norm_ted + norm_ted print 'sum_norm_ted %s %s is %s' % (i, j, sum_norm_ted) -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] unsubscribtion

2008-05-01 Thread bob gailer
Kriti Satija wrote: Please unsubscribe my membership from python tutorlist. Only you can do that. Visit http://mail.python.org/mailman/listinfo/tutor -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http

Re: [Tutor] put?

2008-05-01 Thread bob gailer
m> -------- ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] How to skip to next line in for loop

2008-05-01 Thread bob gailer
print line f.close() The file.txt looks like 1 2 3 4 5 I would like the code to output "4" but I don't know how to use the next. Are there any other way? -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] unsubscribtion

2008-05-01 Thread bob gailer
That sounds like irony. Somehow not suitable for this list or for someone seeking help as to how to unsubscribe. -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] How to skip to next line in for loop

2008-05-02 Thread bob gailer
this if you want less lines of code: f = open('file.txt',r).readlines() print f[[x+1 for x,line in enumerate(f) if line.rstrip() == "3"][0]] -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] How to skip to next line in for loop

2008-05-02 Thread bob gailer
bob gailer wrote: Or even simplre f = open('file.txt',r).readlines() print [f[x+1] for x, line in enumerate(f) if line.rstrip() == "3"][0] -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org ht

Re: [Tutor] Starting a .py file from Idle

2008-05-02 Thread bob gailer
reter. Pray tell, why? Try >>> import program -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] threading: getting latest elements from list/dict

2008-05-05 Thread bob gailer
dictionary or list have to be locked while reading? http://www.python.org/doc/faq/library/#what-kinds-of-global-value-mutation-are-thread-safe -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman

Re: [Tutor] free loop device

2008-05-05 Thread bob gailer
ple 'losetup -a' would be like this: [EMAIL PROTECTED] Desktop]# losetup -a /dev/loop0: [fd00]:11305639 (enc) /dev/loop1: [fd00]:11306533 (/home/nmcbride/Desktop/xxx.iso) Can anyone give me a hand? I for one have no idea how this relates to Python. If others do then they

Re: [Tutor] Excluding a directory in a script...

2008-05-07 Thread bob gailer
Spencer Parker wrote: here is the code: http://dpaste.com/48734/ Please show us the traceback. -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Using Python for accurate calculations

2008-05-12 Thread bob gailer
ocs.python.org/tut/node16.html. -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Using Python for accurate calculations

2008-05-12 Thread bob gailer
using the decimal module http://docs.python.org/lib/module-decimal.html -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] basic lists and loops question

2008-05-14 Thread bob gailer
27;end': datetime.date(1216, 9, 30), 'start': datetime.date(1216, 9, 28), 'long-name': u'Lincoln, Lincolnshire.'} {'placename': u'Lincoln, Lincolnshire', 'processed': True, 'end': datetime.date(1216, 10, 2), 'start': datetime.date(1216, 10, 1), 'long-name': u'Lincoln, Lincolnshire.'} But if I try to call events() thus: for x in events(lst): if x['processed'] == True: print x I get a KeyError. Sounds like the key 'processed' is created by the assignment x['processed'] = True. So those dictionaries that have not experienced this assignment have no such key. You should instead use: if 'processed' in x: Also if x['processed'] == True: can be expressed if x['processed']: HTH -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Iterate through dictionary values and remove item

2008-05-15 Thread bob gailer
4A):[c,d], (2,23A):[a], (2,24A):[a,c,d]} That gives a syntax error at the first A. And the rest of the code lacks indentation. Your code does not match your specification. You said "... if it finds the value 'a' in the values of the key" but you test if

Re: [Tutor] Best way to define comparison

2008-05-17 Thread bob gailer
. Some articles talk about using cmp, and others about the eq...its a little confusing :-( AFAIK either approach is OK. No advantages. (Other than writing one method vs 2). -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor

Re: [Tutor] changin two lines in a single python script

2008-05-21 Thread bob gailer
Content-Type: text/plain; charset=US-ASCII Hi all, How do I replace the same value multiple times without repeating the same variable name/value repeatedly? for ex. some = 'thing' print '%s %s %s %s' % (some,some,some,some) in this case, my question is how do i replace "% (some,some,some)" with something more concise?

Re: [Tutor] changing two lines in a single python script

2008-05-21 Thread bob gailer
re_new(_stext_1,_rtext_1,record) #if found first then replaceit re_new(_stext_2,_rtext_2,record) #else if found second then replace that Will you please help me to correct this script so as to both of the changes occure at a singlr time Thanks for past, now a

Re: [Tutor] changin two lines in a single python script

2008-05-21 Thread bob gailer
Content-Type: text/plain; charset=US-ASCII Hi all, How do I replace the same value multiple times without repeating the same variable name/value repeatedly? for ex. some = 'thing' print '%s %s %s %s' % (some,some,some,some) in this case, my question is how do i replace "% (some,some,some)" with something more concise?

Re: [Tutor] String Replacement question

2008-05-21 Thread bob gailer
ome)" with something more concise? The tersest I can offer is: print '%s %s %s %s' % ((some,)*4) -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] What lib should I use?

2008-05-25 Thread bob gailer
either GET or POST. Examine the HTML of the form to see which. -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] A video introducing Ulipad, an IDE mainly for Python

2008-05-28 Thread bob gailer
Dick Moores wrote: I've been using Ulipad, a free IDE mainly for Python, and written in wxPython, for a couple of years, and think it's terrific. Thanks - IUlipad has some nice features, but I'd miss the debugging in PythonWin. -- Bob Gailer 919-636-4239

Re: [Tutor] why?

2008-05-28 Thread bob gailer
u run this program? When I do I get: File "J:\pipelines\cubed.py", line 11, in if isCube(soma): NameError: name 'isCube' is not defined When I examine the program I'm not surprised to get that exception. -- Bob Gailer 919-636-4239 Chapel Hill, NC __

Re: [Tutor] why?

2008-05-28 Thread bob gailer
(cubed_root - round(cubed_root)) < .01: # this is a guess at close enough, and cheaper than cubing? print i print j print soma -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org h

Re: [Tutor] why?

2008-05-29 Thread bob gailer
Did you see my comments and questions? Please fix the spelling error (iscube vs isCube). And tell us what results you are expecting, and what results you are getting. Nunbers rather than "wrong"! Otherwise we can't help -- Bob Gailer 919-636-4239

Re: [Tutor] finding special character string

2008-06-01 Thread bob gailer
that .dog. and .rat. meet the criteria and list them. How would you do it? And how does this question relate to Python? -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] reading a string into an array

2008-06-01 Thread bob gailer
ine.split('\\')) Even more concise and possibly faster: data = open('out.out').read().replace('\n', '\\').split('\\') a = array(data) a.shape = (384, 512) Kent _______

Re: [Tutor] finding special character string

2008-06-01 Thread bob gailer
hat he thought the user wanted. Precise specification helps ensure desired results. Even in human relationships! OK - what next? How do you react to what I said? -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] create numpy array from list of strings

2008-06-03 Thread bob gailer
If the above is intended to be Python code, it has problems. Rewrite it thusly?: data = [ '33386.472.22-1.11 0.43', '33386.67 3.33 -1.23 0.54', # ... '46728.470.1-1.87-0.54', '46728.479.75.680.38', '46729.

Re: [Tutor] Error-handling for a large modular program

2008-06-06 Thread bob gailer
us an example of how you'd use try-except in your parser? Also are you aware that there are a lot of parser programs out there (some in Python) that might save you time / effort? -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist -

Re: [Tutor] parsing .txt

2008-06-10 Thread bob gailer
n textdata.split('\n'): if line: tag, content = line.split(' ', 1) if tag == "question": questionary.append({tag : content}) else: questionary[-1].update({tag : content}) You might even cons

Re: [Tutor] do I need f.close()

2008-06-10 Thread bob gailer
e data, but also not assigned an object name so am I right in thinking that as the object is 'reclaimed' close() is automatically called ? True. And not, imho, "bad programming" -- Bob Gailer 919-636-4239 Chapel Hill, NC ___

Re: [Tutor] for loop

2008-06-10 Thread bob gailer
yntax is more like foreach in PHP.. for item in somearray[1:]: print i I've tried this to no avail count = 0 for i in range(1,10): if count == 0: continue else: count += 1 print i continue it prints absolutely nothing. -- Bob Gailer 919-6

Re: [Tutor] powerball

2008-06-11 Thread bob gailer
while count2 !=5: number=randrange(55)+1 if number in win: numbers.append(number) else: print "lose" break numbers.sort() ball=randrange(42)+1 if ball==powerball: print "win" print print print win, powerball --

Re: [Tutor] New to Python

2008-06-12 Thread bob gailer
sually a LOT shorter. (3) Python is "lighter" than Java (and C, C++, VB, most other languages) (4) Python comes with a large library of modules that support almost anything you'd want to accomplish. HTH -- Bob Gailer 919-636-4239 Chapel Hill, NC

Re: [Tutor] traverse a two dimensional array

2008-06-18 Thread bob gailer
amit sethi wrote: Hi , Could you please tell me , how i can traverse a two dimensional array , i am sorry , it must be pretty simple but I am new to python am not able to understand. How did you create the array? How have you tried to traverse it? What do you mean by traverse? -- Bob

Re: [Tutor] Help! Character conversion from a rtf file.

2008-06-20 Thread bob gailer
in the line if in dictionary replace with corresponding value write line to output. -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] endless processing through for loop

2008-06-23 Thread bob gailer
you get the same outcome. If you do then let's examine how your program differs. -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Hands-on beginner's project?

2008-06-24 Thread bob gailer
description of rooms and flow between rooms) from the program logic. This makes things a LOT easier. There are more complicated structures in Python that make game programming a LOT easier and more flexible that the above. -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Hands-on beginner's project?

2008-06-25 Thread bob gailer
.", "Pick a direction", n=4, s=5) chapters[4] = Chapter("It's cold in here.", "Pick a direction", e=1, w=2) chapters[5] = Chapter("It's hot in here.", "Pick a direction", u=6, d=3) chapters[6] = Chapter("Congratulations - you found the

Re: [Tutor] Hands-on beginner's project? CORRECTION

2008-06-25 Thread bob gailer
bob gailer wrote: Jacqui wrote: Hi, I'm a total newbie too, and I'm kind of replying to see if my instinct on the whole GOTO thing is correct. It's hard to learn a language without any feedback! I used GW and Color Basic when I was a kid so I know all about GOTO (and i

Re: [Tutor] TypeError: not enough arguments for format string

2008-07-02 Thread bob gailer
erence comes in handy: print_stmt ::= "print" ( [expression ("," expression)* [","]] expression_list ::= expression ( "," expression )* [","] # An expression list containing at least one comma yields a tuple Given that, there is no ambiguity in p

Re: [Tutor] Array filling

2008-07-03 Thread bob gailer
python.org http://mail.python.org/mailman/listinfo/tutor -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] file object in memory

2008-07-04 Thread bob gailer
nic way. Have you considered using a RamDisk? http://en.wikipedia.org/wiki/RAM_disk for general details. http://www.codeguru.com/cpp/w-p/system/devicedriverdevelopment/article.php/c5789/ for a Windows Ram Disk driver installer. I just tried it - it works like a charm. HTH

Re: [Tutor] file object in memory

2008-07-04 Thread bob gailer
Monika Jisswel wrote: You know bob, you are very clever Yes. I've observed that before. , I have used RAM disk for realtime recording of audio before but it never occured to me to use it for light jobs like this one, I just compeletely ignored it as an option & by the way this ope

Re: [Tutor] loops, variables and strings

2008-07-05 Thread bob gailer
ire30,), Remove the trailing , in the last line. It is causing myString to be a tuple. Of course in this scenario, the variables in the parenthesis are strings with newlines in them. But when I do a 'print myString', it shows everything in one line, including the '\n' charac

Re: [Tutor] unsiscribe

2008-07-06 Thread bob gailer
james collins wrote: how do i unsiscribe from the mailing list? Follow the link below -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] search path

2008-07-06 Thread bob gailer
ectory". If that is the case there are several solutions. -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] build list of non-empty variables

2008-07-08 Thread bob gailer
Monika Jisswel wrote: list comprehention : [ x for x in LIST if x != '' ] or just [ x for x in LIST if x ] -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Dynamic Method Creation

2008-07-10 Thread bob gailer
direction? See the new module's instancemethod method. >>> import new >>> class A: ... pass ... >>> a=A() >>> a.f = new.instancemethod(lambda self:'foo', a, A) >>> a.f() 'foo' -- Bob Gailer 919-636-4239 Chapel Hill, NC __

Re: [Tutor] splits and pops

2008-07-12 Thread bob gailer
x27;15', '16', '17', '18', '19', '21', '22', '23', '24', '25', '26', '27', '28', '29'] which I had expected. Give us an example of text for which it does not work. -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] splits and pops

2008-07-12 Thread bob gailer
ike this: test = ['one', 'two', 'three\nfour', 'five', 'six', 'seven\neight', 'nine'] That showed me that I needed to step one extra item, in order to reach the next item that needed to be split. My brain still hurts. E On

Re: [Tutor] Another assert() question

2008-07-13 Thread bob gailer
uding strings, tuples, lists, dictionaries, sets and frozensets). All other values are interpreted as true." -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Check Number of Parameters Passed In

2008-07-13 Thread bob gailer
suggestion consider: def foo(parameter, *args) args will be a tuple with 0, 1 or more items in it. So you can test for len(args) == 1 -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] getting error in uploading a file

2008-07-15 Thread bob gailer
ort 80 can you tell me what is meaning of this error Note it says "More information about this error may be available in the server error log". Take a look at the log. -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor

Re: [Tutor] How to populate a dictionary

2008-07-17 Thread bob gailer
. --- I think that assignment is very poorly worded! Why the busywork of coming up with 100 real dates. What does that have to do with programming? -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org

Re: [Tutor] Raw string

2008-07-20 Thread bob gailer
. The concept does not apply to other forms of strings. >>> x = r"\t" >>> x '\\t' I'm guessing you want >>> x.raw() # to display r"\t" Is that true. That's the only way I can interpret your quest

Re: [Tutor] %(value1, value2) what does this returns

2008-07-22 Thread bob gailer
s Assume symbol = "foo" and stat = "bar". Then url = 'http://finance.yahoo.com/d/quotes.csv?s=foo&f=bar <http://finance.yahoo.com/d/quotes.csv?s=%s&f=%s> -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tut

Re: [Tutor] checking if data files are good, readable, and exist

2008-07-22 Thread bob gailer
', 'rb') >>> f.read() 'this line contains as\r\nbut this has as\r\n' [snip] -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Check for file in different dirs

2008-07-24 Thread bob gailer
what you use to see if a file exists. -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] How to run a Python program under Windows.

2008-07-29 Thread bob gailer
dow flash ever so briefly? Try adding raw_input("press any key to exit") at the end of your program. Of course that will work only if there are no errors in the program. Best way for now is from the command prompt (like "c:\\python25\\python test.py") -- Bob Gaile

Re: [Tutor] Obtaining various combinations of a given word

2008-07-29 Thread bob gailer
m of the latter is a link "The Art Of Computer Programming: Pre-Fascicle 3A, A DRAFT OF SECTION 7.2.1.3: GENERATING ALL COMBINATIONS" by Donald E. Knuth (compressed postscript file)  I have not examined that but it seems to be what you want. -- Bob Gailer 919

Re: [Tutor] How to run a Python program under Windows.

2008-07-30 Thread bob gailer
ills. Of the 4 or 5 replies i think that you would be most help. We all can help. AND PLEASE as I asked, reply to the list not just me. -- Bob Gailer 919-636-4239 Chapel Hill, NC ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Memory error - how to manage large data sets?

2008-07-31 Thread bob gailer
t in the Fibonacci series is an even number. So one could economize slightly: def sumEvenFibonacci(limit): a, b = 1, 1 # don't waste with a = 0 sum = 0 while b < limit: a, b = b, a + b sum += b a, b = b, a + b a, b = b, a + b return sum -- Bo

Re: [Tutor] Why use lambda?

2008-08-02 Thread bob gailer
len(rec.split()), 'lines' : lambda rec, tot: tot + 1, 'minline' :lambda rec, tot: min(len(rec), tot), 'maxline' :lambda rec, tot: max(len(rec), tot), } Consider how many more lines of code it would take if I had to use defs. Consider how reada

Re: [Tutor] Output never stops

2008-08-04 Thread bob gailer
rint "Goodbye!" Consider leveraging the dictionary (and some other"Pythonic" refinements). Separate the logic from the data. Now you can add more names and ages without changing the logic. #!/usr/bin/python person = {'Lary':43, 'Joan':24, 'Bob'

Re: [Tutor] date formatter

2008-08-07 Thread bob gailer
Christopher Spears wrote: Hey, I'm working on a problem out of Core Python Programming (2nd Edition). Basically, I'm creating a class that formats dates. Here is what I have so far: Consider reformatting the month_dict so each name and abbreviation is a key. Then you can just look up th

Re: [Tutor] Python and the Global Interpreter Lock

2008-08-07 Thread bob gailer
OkaMthembo wrote: Hi there, I just came across something called the Global Interpreter Lock, and apparently its a condition where an interpreter locks resources to avoid sharing them with other apps/ processes on the system? I wish to find out what this means in terms of Python. for example do

Re: [Tutor] issue with the Backslash on IDLE 1.2.2

2008-08-08 Thread bob gailer
Marc Rambert wrote: hi, I would like to make some regular expression, unfortunately I can't because the backslash doesn't work Please explain "doesn't work". I interpret that as "I press the \ key and nothing shows up in the active window." -- Bob

Re: [Tutor] issue with the Backslash on IDLE 1.2.2

2008-08-09 Thread bob gailer
. I interpret that as "I press the \ key and nothing shows up in the active window." hi yes you are right and this is when I am in french keyboard. I can't help here but perhaps someone else can. -- Bob Gailer Chapel Hill NC 919-636-4239 When we take the time to be aware

[Tutor] IP matching?.

2008-08-10 Thread bob gailer
72 and n2 >= 16 and n2 <= 31)): lines[i] = r.sub("xxx.xxx.xxx.xxx",lines[i]) # using sub is a little more compact Check out the python regular _expression_ howto - http://www.amk.ca/python/howto/regex/ Greg ___ Tutor maillist -

Re: [Tutor] What has Editor X got that PyWin32 hasn't?

2008-08-13 Thread bob gailer
spe/?abmode=1 looks more promising! -- Bob Gailer Chapel Hill NC 919-636-4239 When we take the time to be aware of our feelings and needs we have more satisfying interatctions with others. Nonviolent Communication provides tools for this awareness. As a coach and trainer I can assist you in le

Re: [Tutor] What has Editor X got that PyWin32 hasn't?

2008-08-13 Thread bob gailer
video) 15 seconds to start (each time it is requested)! Since I depend heavily on the debugger that delay would drive me crazy! -- Bob Gailer Chapel Hill NC 919-636-4239 When we take the time to be aware of our feelings and needs we have more satisfying interatctions with others. Nonv

<    4   5   6   7   8   9   10   11   12   13   >