Re: [Tutor] Tutor Digest, Vol 31, Issue 23 - some jobs are just too big for Python
Sometimes I have also some - or more - problems trying digesting python and feeling totally blocked. My programming experience (beginning at the card-reader aera) main-frame, mini and micro : Bit / Byte / Word system-programming via switch-console followed by Assembler and commercial software using Basic, Cobol, Pascal and SQL. Mnemonic programming-language - in my understanding - can only be consisting of expressions near the human language. The best example for writing non-system-programms are Basic and SQL. Why should I waste time in learning a language like Java (or more positive: python) ? Nevertheless this Tutor Digest is most helpful, the number of questions / problems show some more people are looking for a mnemonic-language which should cross-compile to something with multiplatform-capability like Java. Please let me know, if I am entirely wrong. Klaus Ramelow Betreff: [Tutor] [OT] some jobs are just too big for Python Von: Terry Carroll [EMAIL PROTECTED] Datum: Fri, 8 Sep 2006 15:15:10 -0700 (PDT) An: tutor@python.org An: tutor@python.org http://www.news.com.au/dailytelegraph/story/0,22049,20372915-5006003,00.html Summary: A python (the actual snake) ate an entire pregnant sheep in Malaysia; and was unable to even move afterwards. The story above includes an impressive if somewhat disturbing photo. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Dates
Hi All, I am using the code below to select items from a visual foxpro database where the dates are between the 31/01/2006 and 31/12/2006. The good news is that the code below works. However, I want to make the from and to dates variable. I want to change the range depending on user input. I can't get this to work. I have tried the code below marked Tried but I get the error: Traceback (most recent call last): File C:\test\timemanager.py, line 16, in ? c.execute('SELECT * FROM times where rt_weekst = ? and rt_weekst = ? and rt_type == ?', (a,b,R,)) DataError: ('22005', 301, '[Microsoft][ODBC Visual FoxPro Driver]Operator/operand type mismatch.', 4579) Code that works is below: import mx.ODBC import mx.ODBC.Windows import mx.DateTime db = mx.ODBC.Windows.DriverConnect('DSN=tnt') c = db.cursor() c.execute('SELECT * FROM times where rt_weekst = date(2006,01,31) and rt_weekst = date(2006,12,31) and rt_type == ?', (R,)) for row in c.fetchall(): print row row = str(row) c.close() Tried but get errors: import mx.ODBC import mx.ODBC.Windows import mx.DateTime import datetime a = datetime.date(2006,01,31) b = datetime.date(2006,12,31) db = mx.ODBC.Windows.DriverConnect('DSN=tnt') c = db.cursor() c.execute('SELECT * FROM times where rt_weekst = ? and rt_weekst = ? and rt_type == ?', (a,b,R,)) for row in c.fetchall(): print row row = str(row) c.close() Is there a way to format the date so that the Select statement works? Thanks, John. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Tutor Digest, Vol 31, Issue 23 - some jobs are just too big for Python
Klaus Ramelow [EMAIL PROTECTED] wrote My programming experience (beginning at the card-reader aera) main-frame, mini and micro : Bit / Byte / Word system-programming via switch-console followed by Assembler and commercial software using Basic, Cobol, Pascal and SQL. I go back to a similar era but not on mainframes, I cut my teath on DEC PDP10 and Data General Midi computers Mnemonic programming-language - in my understanding - can only be consisting of expressions near the human language. Yes, but the human language can be mathematics :-) Thus Fortran and PL/1 are not much like English but are mnemonic in form to their users. The best example for writing non-system-programms are Basic and SQL. Interesting choice, I'd have probably included COBOL there too. Why should I waste time in learning a language like Java (or more positive: python) ? Two different questions. Java is a replacement for C++ and tries to be a portable systems language. It has libraries to tackle a lot of fairly low level tasks and is often used where C++B would have been. It offers few advantages over C++ (garbage collection mainly) and has several disadvantages, (speed, no operator overloading etc) but delivers(nearly) the promise of portability. Python is a different kind of language, much close to languages like Perl and Tcl. It is a higher level language in that it requires far fewer lines of code to achieve the same functional;itry - 3-10 times compared to C++ or Java and 3-5 times compared to BASIC in my experience, even compared to modern BASICs like Visual Basic. Pythpon excels in building applications quickly, even if you might have to rewrite some parts in a loewr level language like C++/Java later. Python, is also much easier to learn so plays an important role as a training language - compare it to Logo rather than Pascal in that regard! SQL stands alone as a data access language. It is in no way a general purpose language but it is the de-facto data access mechanism, even in Python.. Nevertheless this Tutor Digest is most helpful, the number of questions / problem show some more people are looking for a mnemonic-language which should cross-compile to something with multiplatform-capability like Java. I don't know how many people consider Pythons cross platform capability to be that high on their list. I certainly don;t. And although Python does compile under the covers I never really think of it as compiled. I just like it as a language which lets me build stuff quickly with minimum thought about the language itself and maximum thought about the problem and solution. Please let me know, if I am entirely wrong. you are not completely wrong but you may be focused on only one aspect of a multi faceted picture. IMHO of course :-) -- Alan Gauld Author of the Learn to Program web site http://www.freenetpages.co.uk/hp/alan.gauld ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] error in writelines
Hi All, I have a list containing 108 filenames. I want to open each file and write it to an output file, appending it to the previous write. I use the code below. Everything appears to work fine until I reach file 107. Only part of the file is written, and file 108 is not written at all. The program runs to completion (I get exit code 0). I debugged the problem and found that readlines() is reading all of file 107's contents but that writelines() is not writing all of file 107's contents. There are no strange characters where the write stops. Any advice would be greatly appreciated. Thanks, Lance - fileobjectw = open(COMPILETRACEDIR + '\\IncludeCode.prg', 'w')for line in listext: line = string.strip(line) fileobjectr = open(line, 'r') sa = fileobjectr.readlines() fileobjectr.close() fileobjectw.writelines(sa) fileobjectw.close() ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] please do not post question about writelines
Hi... I sent a question about an apparent error with writelines. I discovered my error (not closing the file correctly). Please don't post my question. Thanks, Lance ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor