Re: [Tutor] sqlite search
On 18/01/13 18:11, Roger wrote: At the moment this works to search for everything beginning with A sql = SELECT * FROM plants WHERE genus LIKE 'A%'; cursor.execute(sql); SQLlite supports a form of format string where you put in some magic charactrs then provide arguments which SQLLite will substitute in your SQL statement. You can see examples of that in the database topic in my tutorial: file:///home/alang/Documents/HomePage/tutor/tutdbms.htm Look at the address book example near the end for the 'Find Entry' feature, and definitely read the 'word about security' subheading for the correct way to do it! hth -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] sqlite search
On 27 January 2013 18:21, Alan Gauld alan.ga...@btinternet.com wrote: On 18/01/13 18:11, Roger wrote: At the moment this works to search for everything beginning with A sql = SELECT * FROM plants WHERE genus LIKE 'A%'; cursor.execute(sql); SQLlite supports a form of format string where you put in some magic charactrs then provide arguments which SQLLite will substitute in your SQL statement. You can see examples of that in the database topic in my tutorial: file:///home/alang/Documents/HomePage/tutor/tutdbms.htm You might have better luck using this link: http://www.alan-g.me.uk/tutor/tutdbms.htm Look at the address book example near the end for the 'Find Entry' feature, and definitely read the 'word about security' subheading for the correct way to do it! Oscar ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] sqlite search
file:///home/alang/Documents/HomePage/tutor/tutdbms.htm You might have better luck using this link: http://www.alan-g.me.uk/tutor/tutdbms.htm Oops, thanks for spotting that! I keep two copies of the site open in separate browser tabs and mistakenly used the local file version when copying the link. Silly me! Alan G.___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
[Tutor] using ranges with argparse()
Hi -- brand new to python, but trying to write a simple script that takes command line arguments. One of the arguments needs to test if a value is a) an integer and b) within a stated range. I currently have: parser.add_argument(-f, --floor, default=6000, help=floor is the minimum amount of bonus points.,type=int, choices=range(5995, 6001)) This works, but when the user enters an out of bounds value, the help message is unfriendly: % ./bonus.py -f 1 usage: bonus.py [-h] [-f {5995,5996,5997,5998,5999,6000}] MAM-bonus.py: error: argument -f/--floor: invalid choice: 1 (choose from 5995, 5996, 5997, 5998, 5999, 6000) The problem is my default range is actually 0,1 -- I changed it above for brevity's sake. So in the real world, it floods the screen to the point where it's unreadable. I can suppress the whole thing with argparse.SUPPRESS, but then I'm left with no help message at all. Is there a way to suppress the (choose from 1,2,3,etc.) part of the help message? Or a cleaner/different way altogether to accomplish the same thing? thanks. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] HELP- Regarding working with python
Hi all..! wanna know how to compile python script in python command line, and is there any need for setting path for python like JAVA? whats the difference between .py file and .pyc file? Thanks...! On Sat, Jan 19, 2013 at 8:54 AM, bob gailer bgai...@gmail.com wrote: On 1/18/2013 8:03 AM, eryksun wrote: Yes, it's a mistake in the PCA example from the docs: http://mlpy.sourceforge.net/**docs/3.5/dim_red.html#** principal-component-analysis-**pcahttp://mlpy.sourceforge.net/docs/3.5/dim_red.html#principal-component-analysis-pca There seems to be no way to report a bug in that documentation! Or am I missing something? -- 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/tutorhttp://mail.python.org/mailman/listinfo/tutor -- Keep Smiling. Regards Gayu ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor