Re: [Tutor] Combining dictionaries

2005-09-06 Thread bob
At 04:14 PM 9/6/2005, Mike Cheponis wrote: >On Tue, 6 Sep 2005, Danny Yoo wrote:[snip] > >How can I actively help fix these Python bugs? I am concerned when you use the term "bugs". The behaviors you describe are part of the design of Python, and they work as designed. To me a bug is a failure o

Re: [Tutor] Combining dictionaries

2005-09-07 Thread bob
1972, maintained the APL interpreter in 1975 and devised and helped implement my first language in 1976. My BSEE from RPI predates any CS departments. Bob Gailer phone 510 978 4454 ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] making a table

2005-09-08 Thread bob
At 04:34 PM 9/8/2005, [EMAIL PROTECTED] wrote: I would like to construct a table for my program but it does not seem to be coming out evenly. Could someone please let me know what to do so that everything will work out correctly? def main():    print "This program shows a table of Celsius tempe

Re: [Tutor] Aschenputtel problem

2005-09-16 Thread bob
At 10:12 AM 9/15/2005, Christopher Arndt wrote: >Hi, > >I wonder if there is a shorter form of the following idiom: > >list1 = [] >list2 = [] >for item in original_list: > if condition(item): > list1.append(item) > else: > list2.append(item) Consider (5 lines instead of 7):

Re: [Tutor] Why won't it enter the quiz? (off topic)

2005-09-16 Thread bob
At 09:30 PM 9/16/2005, Nathan Pinno wrote: >Hey all, > >It looks like I started another running debate, the last time I did this, it >went forever it seemed. > >Any hints or help on that original question? > >For clarity, I'll ask it again: > >Why won't it enter the quiz? Here is the code again: >

Re: [Tutor] Iterating over sorted dictionary keys in one line

2005-09-18 Thread bob
At 10:30 AM 9/18/2005, Kent Johnson wrote: >Marcin Komorowski wrote: > > I know that one of the ways to iterate over sorted dictionary keys is: > > keylist = dictionary.keys() > > keylist.sort() > > for key in keylist: > > ... > > > > Is there a way to do this in a single line.

Re: [Tutor] Challenge [was Re: Why won't it enter the quiz?]

2005-09-22 Thread bob
At 06:42 PM 9/22/2005, Nathan Pinno wrote: The URL is http://zoffee.tripod.com/purchasecomprogs.htm [snip] At your invitation I visited the site. I personally would not purchase anything listed there due to insufficient information. I don't know what I'm getting! I suggest you dedicate a page to

Re: [Tutor] Diamond Equivalent

2005-09-22 Thread bob
At 03:46 PM 9/22/2005, [EMAIL PROTECTED] wrote: >I am coming to Python from Perl. Does Python have anything like the diamond >operator found in Perl? Some of us (who don't know Perl) might help you if you tell us what the diamond operator does. How could we get to first base with it? What are its

Re: [Tutor] Diamond Equivalent

2005-09-23 Thread bob
At 04:37 AM 9/23/2005, [EMAIL PROTECTED] wrote: >[snip] >In perl I can write this: > >@array = <>; >print @array; > >If I save that and call it from the command line, I can include the name of a >file after the script name. It will read in the file, putting each line >into an >element of the array

Re: [Tutor] File mode r+

2005-09-24 Thread bob
At 01:11 AM 9/24/2005, Shitiz Bansal wrote: >Hi, >I want to update a textfile using the r+ file mode. >contents of file: > >abcd >efgh >ijkl >mnop >qrst >uvwx >yx12 > >my scripts is: > >file1=open("aa.txt",'r+') Instead of readline, use skip to position the file to where you want to overwrite it.

Re: [Tutor] Sum of List Elements

2005-09-24 Thread bob
At 08:11 AM 9/24/2005, Luke Jordan wrote: >Hi All, > >I have spent an embarrassingly large amount of time trying to solve what >on its face seems like a simple problem. > >I have a list of intergers, and I want to assign the sum of the intergers >in the list to a variable. There are only interger

Re: [Tutor] (no subject)

2005-09-24 Thread bob
At 03:29 PM 9/24/2005, [EMAIL PROTECTED] wrote: Hello How would I get the following program to accept inputs of exam scores from 0-100 with A being 100-90, B being 89-80, C being 79-70, D being 69-60, and F being everything less than 60? Many solutions are available. One could use an if stateme

Re: [Tutor] Challenge [was Re: Why won't it enter the quiz?]

2005-09-26 Thread bob
At 10:34 AM 9/26/2005, Nathan Pinno wrote: Bob,   I did what you suggested. Take another look, and tell me if you were a potential customer, would you purchase something?  I tried http://zoffee.tripod.com/purchasecomprogs.htm I got "Sorry but the page ... is not here."   Sorry, but t

Re: [Tutor] Challenge [was Re: Why won't it enter the quiz?]

2005-09-26 Thread bob
At 10:56 AM 9/26/2005, Nathan Pinno wrote: The actual URL is http://zoffee.tripod.com/purchasecompprogs.htm I did what you suggested. Take another look, and tell me if you were a potential customer, would you purchase something? No. For one thing I can (if I didn't already have one) buy a "re

Re: [Tutor] Quick way to find the data type

2005-09-27 Thread bob
At 12:08 PM 9/27/2005, Bernard Lebel wrote: >Hello, > >Let say I have a string. The value of the string might be 'False', >'True', '3', '1.394', or whatever else. Is there a quick way to >convert this string into the appropriate data type other than with >try/except? eval()?

Re: [Tutor] call a def/class by reference

2005-09-28 Thread bob
At 04:29 PM 9/28/2005, DS wrote: >What I'm hoping to avoid is an >explicit reference to any of the called functions within the program. >By doing it that way, it would avoid a maintenance problem of having to >remember to put a reference for every new function in the calling program. Try this - a

Re: [Tutor] call a def/class by reference

2005-09-29 Thread bob
At 08:23 AM 9/29/2005, DS wrote: >bob wrote: > > > At 04:29 PM 9/28/2005, DS wrote: > > > >> What I'm hoping to avoid is an > >> explicit reference to any of the called functions within the program. > >> By doing it that way, it would avoid a maint

Re: [Tutor] Load PDF

2005-10-03 Thread bob
I am moving this to the python-win32 list where we can better handle it. Please send further replies there. At 03:41 AM 10/3/2005, Pepe Pena wrote: >I am attempting to load a pdf file programatically within Adobe Reader >using the Adobe Acrobat 7.0 Browser Control Type Library. If I run this >c

Re: [Tutor] Line continuation with readlines

2005-10-05 Thread bob
At 07:20 PM 10/3/2005, Craig MacFarlane wrote: >Hello, > >Is there a way to make line continuation work with >the readlines function? > >i.e. Do you mean e.g.? > this is \ > one line. I assume the above is a 2 line file you wish to read using a file object's readlines method. There is not

Re: [Tutor] Regex help

2005-10-09 Thread bob
At 09:10 PM 10/9/2005, Bill Burns wrote: >I'm looking to get the size (width, length) of a PDF file. Every pdf >file has a 'tag' (in the file) that looks similar to this > >Example #1 >MediaBox [0 0 612 792] > >or this > >Example #2 >MediaBox [ 0 0 612 792 ] > >I figured a regex might be a good way

Re: [Tutor] help with elif statements

2005-10-12 Thread bob
At 06:04 PM 10/12/2005, [EMAIL PROTECTED] wrote: >hello > >below is my code and everytime I input a value of 16 or more it keeps >returning sophomore. could anyone help me figure out what to change so >that it won't return sophmore for things greater than or equal to 16? > >def getcredits(num): >

Re: [Tutor] passing variable to python script

2005-10-13 Thread bob
At 04:09 PM 10/13/2005, Marc Buehler wrote: >hi. > >i want to pass an argument (a number) to a python >script when running it: > > python script.py > >i want to be able to use within script.py >as a parameter. > >how do i set this up? In the sys module there is a property argv. The docs say: "Th

Re: [Tutor] extract plain english words from html

2005-10-14 Thread bob
At 03:50 PM 10/14/2005, Marc Buehler wrote: >hi. > >i have a ton of html files from which i want to >extract the plain english words, and then write >those words into a single text file. http://www.crummy.com/software/BeautifulSoup/ will read the html, let you step from tag to tag and extract the

Re: [Tutor] Focus on the functions [Was Re: if-else statements]

2005-10-16 Thread bob
At 08:11 AM 10/16/2005, Norman Silverstone wrote: >I am an elderly person somewhat physically handicapped with some >experience programming in basic and pascal, many years ago. In order to >keep myself mentally active I decided to have a look once again at >programming and chose python as a good l

Re: [Tutor] Saving command line keyed input?

2005-10-19 Thread bob
At 02:12 PM 10/19/2005, CPIM Ronin wrote: >I know that one should use IDLE or a choosen editor for any substantial >Python coding! However, if one happens to have written some interesting >doodlings on the regular command line interface (under Windows XP in my >case), is there an easy way to save

Re: [Tutor] iteration is overwriting the previous set value

2005-10-19 Thread bob
At 04:16 PM 10/19/2005, Jonas Melian wrote: >def _pre_save(self): > for field in [self.name, self.native_name]: > if not field.istitle(): > #print field.title() > field = field.title() > >The change I try to do there (field = field.title()) is not being applied

Re: [Tutor] iteration is overwriting the previous set value

2005-10-19 Thread bob
At 04:16 PM 10/19/2005, Jonas Melian wrote: >def _pre_save(self): > for field in [self.name, self.native_name]: > if not field.istitle(): > #print field.title() > field = field.title() And FWIW there is no benefit in using "if not field.istitle():" since it cal

Re: [Tutor] iteration is overwriting the previous set value

2005-10-20 Thread bob
At 12:32 AM 10/20/2005, Jonas Melian wrote: >bob wrote: > > > At 04:16 PM 10/19/2005, Jonas Melian wrote: > > > >> def _pre_save(self): > >> for field in [self.name, self.native_name]: > >> if not field.istitle(): > >>

Re: [Tutor] new user question about while loops

2005-10-25 Thread bob
At 10:53 PM 10/25/2005, Nick Eberle wrote: Content-class: urn:content-classes:message Content-Type: multipart/alternative; boundary="_=_NextPart_001_01C5D9F1.A836CF4F" Sorry for potential double post, error with first send --

Re: [Tutor] new user question about while loops

2005-10-26 Thread bob
Thank you for posting your code. That really helps us see where you are and therefore how to help. I encourage you to "desk check" your code: pretend you are the computer: write down the values of variables and expressions as things change. Evaluate each statement to see what it does. Example: he

Re: [Tutor] File IO Help again

2005-10-27 Thread bob
At 12:18 PM 10/27/2005, Mike Haft wrote: >Apologies for not making things clearer last time. > >My specific problems are: > >why can I not get the readline() or readlines() functions to work, I'm >told they are not defined whenever I try. Mike * Oh * Mike ... and all others ... Please Post The Co

Re: [Tutor] File IO Help again

2005-10-27 Thread bob
At 01:42 PM 10/27/2005, Adam wrote: > >if line[:1] == "1": > >This line won't work because you're getting the first 2 characters from >the line Oh? Did you test that? When I do that I get 1 character. Why? Because slicing goes UP TO the 2nd argument. >>> 'abc'[:1] 'a'

Re: [Tutor] Can anyone help me?

2005-10-27 Thread bob
At 07:07 PM 10/27/2005, Nathan Pinno wrote: >Hey all, >I am trying to create a program that draws 6 numbers between 1 and 49 at >random for creating lottery tickets. I want to have a better chance when I >play. Define "better chance". Lottery odds are how many tickets you buy relative to how ma

[Tutor] Plea for Meaningful Subject Lines (was: Can anyone help me?)

2005-10-27 Thread bob
Please in future provide meaningful subject lines. It makes it a lot easier to track the threads. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] IDLE error msgs and line continuations?

2005-10-27 Thread bob
At 08:06 PM 10/27/2005, Jason Massey wrote: >All you need is the line continuation character, '\': > >if (condition 123 and \ >condition 456) : Did you test that (or even read it)? That is a syntax error line continuation or not! Also recall that the parentheses obviate the need for the \.

Re: [Tutor] Can anyone help me?

2005-10-28 Thread bob
At 09:42 PM 10/27/2005, Nathan Pinno wrote: >If I create a program that randomly draws 6 numbers, its like the lottery. >According to an article I read in Reader's Digest, if you get a Quick Pick >- which is six numbers at random - you increase your odds of winning. Odds are how many tickets yo

Re: [Tutor] equivalent of 'last' in perl

2005-10-28 Thread bob
At 09:50 PM 10/27/2005, Johan Meskens CS3 jmcs3 approximated: >what is Python's equivalent of 'last' in perl? > >if flag == 1: > break Yes. If flag is either 1 or 0 you may code it thus: if flag: break That's not the whole truth. Most types have a value that is seen as false in b

Re: [Tutor] Can anyone help me?

2005-10-28 Thread bob
At 07:28 AM 10/28/2005, Smith, Jeff wrote: Aren't the odds just based on how many tickets you buy?  The odds aren't affected by different people buying more tickets.  If only one person buys a ticket in the entire lottery system, his odds of winning are the same as if two people play, and the sam

Re: [Tutor] Can anyone help me?

2005-10-28 Thread bob
tails is 1. The odds therefore are the same. If you flip 2 coins then the odds of both being heads is 1/3, ditto both tails. Odds of being different is 1/2.   Jeff   -Original Message- From: bob [mailto:[EMAIL PROTECTED]] Sent: Friday, October 28, 2005 10:52 AM To: Smith, Jeff; Tutor@pyt

Re: [Tutor] Can anyone help me?

2005-10-28 Thread bob
At 08:03 AM 10/28/2005, Nathan Pinno wrote: >Hey, >I created it. Want to see the code? >Here it is: >[code] >import random >numbers = [] Move this inside the loop following if q == 1 and get rid of the occurrence of this statement following print numbers. Less code, easier to read, more to the p

Re: [Tutor] Turning kwargs into scalars

2005-11-01 Thread bob
At 08:52 PM 10/31/2005, Steve Bergman wrote: >Say I have a function: >def f(self, **kwargs) : FWIW you don't have a function at this point. You have a def statement which must be followed by at least one indented statement, which in turn must be executed. Then you have a function. >and I want t

Re: [Tutor] while/if/elif/else loops

2005-11-02 Thread bob
At 02:36 PM 11/1/2005, Zameer Manji wrote: >Ok after looking at everyones replies my program looks like this: > >#Coin Toss Game >#Zameer Manji >import random > >print "This game will simulate 100 coin tosses and then tell you the >number of head's and tails" > >tosses = 0 >heads = 0 >tails = 0 > >

Re: [Tutor] printing statement

2005-11-03 Thread bob
At 11:31 AM 11/3/2005, Johan Geldenhuys wrote: >Hi all, >Just a quick question; > >How do I code this output: >""" >files dirs >== >""" > >I want to print something a few space away from the left side or in the >middle of the line. In the Python Library Reference look up 2.3.6.2 S

Re: [Tutor] printing statement

2005-11-03 Thread bob
At 11:31 AM 11/3/2005, Johan Geldenhuys wrote: >Hi all, >Just a quick question; FWIW saying that does not help. It takes time to read it, and I can judge the question length by reading the question. The real concern is what does it take to construct an answer. _

Re: [Tutor] File IO

2005-11-03 Thread bob
At 01:34 PM 11/3/2005, Michael Haft wrote: >Hello, > I tried the following code: > >def readSOMNETM(inputName): > input = open(inputName, "r") > result = [] > for line in input: > fields = line.split() # add this; it will show you what line(s) have less than 8 f

Re: [Tutor] File IO

2005-11-03 Thread bob
[snip] Colin: your replies to 2 e-mails indicate that you have either not read the e-mails or the prior responses. Please consider the work others put into replying before replying. Example: I suggested % formatting in a reply. You replied to that by saying the same thing.

Re: [Tutor] printing statement

2005-11-04 Thread bob
At 10:02 PM 11/3/2005, Johan Geldenhuys wrote: Found it. This is what I was looking for: """ >>> print ('file'+'dir'.center(20))+('\n'+'='*15) file    dir === >>>   """ I am glad you found what you wanted. I'm sad that you did not tell us more precisely what you wanted, as we cou

Re: [Tutor] Namespace Problem

2005-11-04 Thread bob
At 05:47 PM 11/4/2005, Carroll, Barry wrote: >I have a function that makes use of several global variables: > >## >Include struct Did you mean "import"? >ABC = 1 >DEF = 2 >xyz = 0 >def do_stuff(in_str): > hdr = struct.pack('@2BH',ABC|DEF,xyz,len(in_str)) > newstr = hdr+in_str Wor

Re: [Tutor] pack

2005-11-05 Thread bob
At 01:57 PM 11/5/2005, Shi Mu wrote: >when I clicked 'quit' button, >there is no response. I want to close the interface by clicking 'x', >the interface could not be closed. >i had to close PYTHONWIN to get out of the program. That is a known problem running Tkinter stuff under PythonWin. Others m

Re: [Tutor] main

2005-11-05 Thread bob
At 03:39 PM 11/5/2005, Shi Mu wrote: >It is very hard for me to understand why we need the following line? >if __name__ == "__main__": We don't need it. Often we code a module for importing into another module. But sometimes we also want to run the module independently as a Python program, perha

Re: [Tutor] Python and Semantic Web

2005-11-08 Thread bob
At 08:19 AM 11/8/2005, Matt Williams wrote: >Dear List, > >Does anyone know of any python semweb tools? I'm especially interested >in tools to build and handle ontologies. I've come across CWM (built by >Tim BL) but not that much else. I'd be really interested in anything >that can interface with a

Re: [Tutor] Trouble with classes - Pypeg again

2005-11-21 Thread bob
At 08:52 PM 11/20/2005, ->Terry<- wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ok, I've got my peg game roughed out and I'm having problems. The error is: Traceback (most recent call last):    File "pypeg.py", line 113, in ? main()    File "pypeg.py", line 107, in main x.draw_b

Re: [Tutor] Help with objects

2005-11-21 Thread bob
At 08:38 PM 11/21/2005, Vincent Wan wrote: >I'm trying to write a tree data structure as part of my first >object oriented program > >I have an error "can't assign to function call" caused by this line: >Tree.nodeList(self.name) = self Tree.nodeList[self.name] = self >however, nodeList is a dicti

Re: [Tutor] Help with objects

2005-11-22 Thread bob
At 09:04 PM 11/21/2005, Vincent Wan wrote: >Thank you bob. I fixed the errors where I tried to index a dictionary >with name() >so so that they say name[] > >>>Beyond the error I'm still not sure I understand how to make and >>>use a tree data structure using

Re: [Tutor] Newbie question

2005-11-22 Thread bob
At 12:20 PM 11/22/2005, Liam Clarke-Hutchinson wrote: Hi Eric,   Either -   add this line to the end of your scripts - discard = raw_input("Press enter to finish.")   Or -   Click on Start > Run... type cmd.exe and use DOS to move to the directory where your scripts are stored and run them via

Re: [Tutor] TRULY NEWBIE - MENTOR NEEDED

2005-11-22 Thread bob
At 02:41 PM 11/22/2005, mike donato wrote: >Greetings, I am new student to programming and am experimenting with PYTHON. > >From what I have read, seems to be a very versatile language. In the >following excercise I am getting an error > >class String(str, Object): try -> class String(str, object)

Re: [Tutor] sort list alphabetically

2005-11-23 Thread bob
At 09:55 AM 11/23/2005, lmac wrote: >i have a list with the dirs/files from the current path. When i use >sort() to sort the list alphabetically the list is still unsorted. When you say "unsorted" - are the list members in the same order as before the sort? >dirs_files = os.listdir(os.getcwd())

Re: [Tutor] How to discover which OS my python is running?

2005-11-23 Thread bob
At 06:31 PM 11/23/2005, Diego Galho Prestes wrote: >Hi! I'm using a program that I want to know if I'm running the program >in Linux or Windows. How can I do this? I want this because I created >all my program in Linux but if someone runs it in Windows I have to do >some things to make it work well

Re: [Tutor] Read Excel file without COM

2005-11-29 Thread bob
At 11:58 AM 11/29/2005, [EMAIL PROTECTED] wrote: >Hi, > >I have written a script which reads a Microsoft Excel file and moves >the data inside onto a database. The script uses the PyWin32 module >written by Mark Hammond, but I was wondering if anyone knew of a way >to extract the data without usin

Re: [Tutor] Read Excel file without COM

2005-11-29 Thread bob
At 01:45 PM 11/29/2005, John Fouhy wrote: >On 30/11/05, bob <[EMAIL PROTECTED]> wrote: > > Interesting you ask at the same time I'm researching this question. I found > > http://sourceforge.net/projects/pyexcelerator > > Somewhere I thought I saw a reference to its

Re: [Tutor] MS ODBC

2005-12-06 Thread bob
At 09:57 PM 12/5/2005, Gregorius Gede Wiranarada wrote: >hello, >how can i connect python to read data from ms access or ms foxpro? foxpro: Install (if you have not) Mark Hammond's pywin32 to get the odbc module http://sourceforge.net/project/showfiles.php?group_id=78018 Create a Data Source (if

Re: [Tutor] Timer

2005-12-06 Thread bob
At 06:57 AM 12/6/2005, Joseph Quigley wrote: >I'd like to make a 30 minute timer. How an I do that? With time? import time time.sleep(30) ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Timer

2005-12-08 Thread bob
At 07:18 PM 12/6/2005, Liam Clarke-Hutchinson wrote: >Hi, > >time.sleep() takes an argument as seconds. Oh yeah I know that but forgot.Sigh. Thanks for the correction. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tuto

Re: [Tutor] advice on idiom replacing if test requested

2005-12-11 Thread bob
At 04:15 PM 12/11/2005, Brian van den Broek wrote: >Hi all, > >I have a case like this toy code: > >import random >list1 = [1,2,3] >list2 = ['a', 'b', 'c'] >item = random.choice(list1 +list2) >if item in list1: > others = list2 >else: > others = list1 > > >Another way occurred to me, but

Re: [Tutor] Scope Problem with Files

2005-12-14 Thread bob
At 11:13 AM 12/14/2005, Carroll, Barry wrote: >Greetings: > >I am implementing a (crude but useful) debug facility in my test >system client software. Basically, I test the value of a global >Boolean. It True, I write pertinent data to a text file. I want to >do this in multiple functions in a

Re: [Tutor] Python - SQL paradigm (Will I need a hammer to make it fit?)

2005-12-15 Thread bob
At 02:14 AM 12/14/2005, Liam Clarke wrote: >Hi all, > >Just contemplating. > >If in Python I were organising a data index along the lines of - > >j = { > >"k_word1" : ["rec1","rec2","rec3","rec4"], >... >"k_wordn" :["recX","rec4"] > >} > >and I was going to find records that matched by seeing what

Re: [Tutor] Input checking [letters or numbers]

2005-12-23 Thread bob
At 10:15 AM 12/23/2005, Panagiotis Atmatzidis wrote: >Hello, > >Can someone provide me with an error checking example about an x >variable that needs to be number only? I used something like: > > def useridf(): > print "" > print "WARNING: If you don't understand why this must be unique,

Re: [Tutor] Input checking [letters or numbers]

2005-12-23 Thread bob
At 11:16 AM 12/23/2005, Panagiotis Atmatzidis wrote: >Hello there, > >Thank you for the prompt response. > >On 12/23/05, bob <[EMAIL PROTECTED]> wrote: >[snip] > > print input("x ; ") > > and enter "Hello world" > > >>> x = in

Re: [Tutor] Input checking [letters or numbers]

2005-12-23 Thread bob
At 11:28 AM 12/23/2005, Panagiotis Atmatzidis wrote: >On 12/23/05, Panagiotis Atmatzidis <[EMAIL PROTECTED]> wrote: > > Hello Dany :-) > > > > On 12/23/05, Danny Yoo <[EMAIL PROTECTED]> wrote: >[...] > > > > > > > > > Hello Bob a

Re: [Tutor] Problem with os.access function. [semantic error, if check does not work]

2005-12-24 Thread bob
At 05:20 AM 12/24/2005, Panagiotis Atmatzidis wrote: >Hello, > >I am writing a function in order to check if a directory exists. If >exists the functions must do nothing, otherwise must check the users >permissions and if it's possible create the dir. Looking at pydoc's >httpd I found the module "o

Re: [Tutor] is there any tool like "run line or selection" in Pythonwin?

2005-12-25 Thread bob
At 04:30 AM 12/25/2005, linda.s wrote: >is there any tool like "run line or selection" in Pythonwin? Shades of Visual FoxPro? Create a script (I call it testbed.py). Open it in a script window, paste the selection there, hit F5. Since this executes in the main namespace the results will persist

Re: [Tutor] Printing

2005-12-27 Thread bob
At 08:52 AM 12/26/2005, John Corry wrote: >Thanks for the prompt reply. This is exactly what I am looking for. >However, I have tried the code on the page and I can't get it to work. > >import tempfile >import win32api > >filename = tempfile.mktemp (".txt") >open (filename, "w").write ("This is a

Re: [Tutor] Extracting data from HTML files

2005-12-28 Thread bob
At 01:26 PM 12/28/2005, [EMAIL PROTECTED] wrote: >[snip] >I`m trying to make a python script for extracting certain data from HTML >filesSay for example the HTML file has the following format: >Category:Category1 >[...] >Name:Filename.exe >[...] >Description:Description1. > >Taking in to accoun

Re: [Tutor] Avoiding repetetive pattern match in re module

2006-01-05 Thread bob
At 02:41 AM 1/5/2006, Intercodes wrote: Hello everyone,     Iam new to this mailing list as well as python(uptime-3 weeks).Today I learnt about RE from http://www.amk.ca/python/howto/regex/.This one was really helpful. I started working out with few examples on my own. The first one was to colle

Re: [Tutor] string to integer

2006-01-05 Thread bob
At 12:40 PM 1/5/2006, Boyan R. wrote: >I need program to convert my string in integer. >I remember in BASIC I used val(string) command >Is there a Python equivalent ? > >Here is how it should work: >val(7) = 7 >val(bbab7) = 7 >val(aa7aa) = 7 >val( 7) = 7 > >This last is most important, currently

Re: [Tutor] Landscape Printing

2006-01-09 Thread bob
At 05:48 AM 1/8/2006, John Corry wrote: >Hi, > >My text file is printing out in portrait. Is there any instruction that I >can use so that notepad prints it in landscape? I doubt that you can do this with notepad. Certainly not with ShelleExecute. You could do some fancy footwork with opening no

Re: [Tutor] div_t

2006-01-11 Thread bob
At 02:59 PM 1/11/2006, Burge Kurt wrote: >Hi, > >What is the usage of div_t in python? > >I have some unsigned integer variables and want to use ; > >div_t div_T; >div_t div_N; >div_t div_B; Your question is meaningless to me! Please clarify. div_t is not a Python constant or built_in. div_t div

Re: [Tutor] Finding the Index of a member of a Tuple

2006-01-11 Thread bob
At 08:31 PM 1/11/2006, Steve Haley wrote: >Hello everyone, > >I need to do something very simple but I'm having trouble finding >the way to do it - at least easily. I have created a tuple and now >need to find the position of individual members of that >tuple. Specifically, the tuple is someth

Re: [Tutor] Finding the Index of a member of a Tuple

2006-01-12 Thread bob
At 10:52 PM 1/11/2006, Brian van den Broek wrote: >[snip] > >I assume Bob meant that tuples have no index or find method. No, Bob is sick and not thinking clearly. At 11:04 PM 1/11/2006, Terry Carroll wrote: >Does it have to be a tuple? If you make it a list, you can use index():

Re: [Tutor] __getitem__

2006-01-16 Thread bob
At 12:12 PM 1/16/2006, Christopher Spears wrote: >I understand that you can use __getitem__ as a hook to >modify indexing behavoir in a class. That's why >__getitem__ not only affects [] but also for loops, >map calls, list comprehension, etc. For loops, etc. >work by indexing a sequences from z

Re: [Tutor] Open file error

2006-01-17 Thread bob
At 09:23 AM 1/17/2006, Paul Kraus wrote: >On Tuesday 17 January 2006 12:11 pm, andy senoaji wrote: > > I am starting to pull my hair here. There were some postings in the past, > > similar to my problem, but the response was not clear enough. Sorry if you > > thingk I am reposting this. > > > > I a

Re: [Tutor] namespace confusion

2006-01-18 Thread bob
At 02:25 PM 1/18/2006, Christopher Spears wrote: Let's say I have two classes: >>> class super: ... def hello(self): ... self.data1 = 'spam' ... >>> class sub(super): ... def hola(self): ... self.data2 = 'eggs' ... Now let's look in the classes' namespaces using __dict__:

Re: [Tutor] I'm puzzled

2006-01-22 Thread bob
At 03:46 PM 1/22/2006, Vincent Zee wrote: >Why will this little program crash when you enter the enter key? Thank you for including the "traceback" message in your 2nd post. Index error means you tried to reference an element of a sequence that is not there. a is the empty string when you just h

Re: [Tutor] PLZ REPLY SOON

2006-01-23 Thread bob
At 10:24 PM 1/22/2006, Shalini R wrote: >Hi sir, > I'm new to python & postgres as I've created a form in html & a >table in postgres. There is a field in form which will take multiple >value My guess is that each checkbox needs its own name, rather than all of them using arrFacility. Give that

Re: [Tutor] Accuracy of time.sleep()

2004-12-04 Thread Bob Gailer
u get something other than a command not found kind of error then we can do something. Let us know. Bob Gailer [EMAIL PROTECTED] 303 442 2625 home 720 938 2625 cell ___ Tutor maillist - [EMAIL PROTECTED] http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Simple RPN calculator

2004-12-05 Thread Bob Gailer
list's append() and pop() methods). For grins I just wrote one that takes '1 2.3 - 3 4 5 + * /' as input and prints -0.0481481 8 lines of Python. That indeed is less than 100. Took about 7 minutes to code and test. Bob Gailer [EMAIL PROTEC

[Tutor] Re: Can I see it?

2004-12-05 Thread Bob Gailer
At 03:36 AM 12/5/2004, you wrote: Hi Bob, That is what I am looking for! A simple RPN calculator program! Can I see what you have please? That depends. Are you are working on a homework assignment? I ask because when we see several posts of a similar question we suspect it is an assignment given

[Tutor] Re: Can I see it?

2004-12-06 Thread Bob Gailer
At 02:06 PM 12/5/2004, Just Incase wrote: Hi Bob, Yea, it is a homework and I would also like to do something on it to get familiar with the program, so all I am asking for is if there are the pionters to help me. Like I said I am new to python/programming but I have limited time to turn-in the

Re: [Tutor] Printing two elements in a list

2004-12-07 Thread Bob Gailer
ele1 in x: for ele2 in seq: if match: print ele2 match = False if ele1 in ele2: print ele2 match = True OR for ele1 in x: for index, ele2 in enumerate(seq): if ele1 in ele2: print ele2, seq[index+1] [snip] B

Re: [Tutor] "TypeError: 'int' object is not callable"??

2004-12-08 Thread Bob Gailer
s: DO function WITH parameters (FoxPro, similar in COBOL) function parameter or parameter1 function parameter2 (APL) Bob Gailer [EMAIL PROTECTED] 303 442 2625 home 720 938 2625 cell ___ Tutor maillist - [EMAIL PROTECTED] http://mail.python.org/mailman/li

Re: [Tutor] "TypeError: 'int' object is not callable"??

2004-12-08 Thread Bob Gailer
At 12:39 PM 12/8/2004, Bob Gailer wrote: At 11:27 AM 12/8/2004, Dick Moores wrote: My thanks to both Max and Kent. So Python tries, and fails, to see 2() as a function! I also got some help from <http://www.pcwebopedia.com/TERM/c/call.html> Note that SOME languages use () for call. The

Re: [Tutor] Please help matching elements from two lists and printing them

2004-12-08 Thread Bob Gailer
nts of a spot_int element to match a spot_cor element. Then (for the subset of data you've provided): >>> for ele1 in spot_cor: ... for ele2 in spot_int: ... if ele1 == ele2[:2]: ... print "%8s %8s %8s" % ele2 ... 10

Re: [Tutor] Simple RPN calculator

2004-12-08 Thread Bob Gailer
At 06:05 AM 12/6/2004, you wrote: Bob Gailer wrote: > For grins I just wrote one that takes '1 2.3 - 3 4 5 + * /' as input > and prints -0.0481481 8 lines of Python. That indeed is less than > 100. Took about 7 minutes to code and test. I'm quite interested in seeing

Re: [Tutor] Difference between for i in range(len(object)) and for i in object

2004-12-09 Thread Bob Gailer
you don't seem to benefit from some of our suggestions. Bob Gailer [EMAIL PROTECTED] 303 442 2625 home 720 938 2625 cell ___ Tutor maillist - [EMAIL PROTECTED] http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Difference between for i in range(len(object)) andfor i in object

2004-12-12 Thread Bob Gailer
don't they just read the book?" That's how I learned almost everything I know about programming. So it can be hard for me to understand your struggle. Nuf said for now... [snip] Bob Gailer [EMAIL PROTECTED] 303 442 2625 home 720 938 2625 cell _

Re: [Tutor] Leading zero for hex numbers

2004-12-15 Thread Bob Gailer
hich it should instead of 0x03039 and print "0x%05X" % 12345 displays 0x03039 The Python docs state The conversion will be zero padded for numeric values, when a 0 is used as a flag between the % and the conversion type. If you continue in the documentation right after 3 Conversion flags comes

Re: [Tutor] am I missing another simpler structure?

2004-12-15 Thread Bob Gailer
e, and then writing if e == True: instead of if e: For some reason, that's extremely common in code written by newcomers to Pascal. Not to mention coding examples provided by Microsoft in some help topics! [snip] Bob Gailer [EMAIL PROTECTED] 303 442 2625 home 720 938 2625 cell _

Re: [Tutor] Question on "import foobar" vs "from foobar import *"

2010-01-09 Thread bob gailer
t a new reference to the original attribute. Example >>> import sys >>> from sys import modules >>> sys.modules is modules True >>> m = dict(sys.modules) # create a copy >>> m is modules False -- Bob Gailer Chapel Hill NC 919-636-4239

Re: [Tutor] help with random.randint

2010-02-02 Thread bob gailer
terseness: terms = [random.randint(1, 99) for i in 'ab'] -- Bob Gailer 919-636-4239 Chapel Hill NC ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] help with random.randint (cont. -- now: pseudo code)

2010-02-02 Thread bob gailer
swers. Good idea? Yes indeed. That is what I did before reading your comment! Great minds think alike. -- Bob Gailer 919-636-4239 Chapel Hill NC ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

  1   2   3   4   5   6   7   8   9   10   >