Re: [Tutor] How to test for the existence of a table in a sqlite3 db?

2017-10-14 Thread Flynn, Stephen (L & P - IT)
Yep - oracle for example has hundreds of tables which hold metadata. for example (this will look terrible due to the length of it but if you assume it's 3 lines; a title line, some underlining for each column and the data itself): SQL> select * from all_tables where owner = 'FLYNNS' and

[Tutor] How do I (idiomatically) determine when I'm looking at the last entry in a list?

2015-10-28 Thread Flynn, Stephen (L & P - IT)
Afternoon, Python 3. I'm iterating through a list and I'd like to know when I'm at the end of the said list, so I can do something different. For example list_of_things = ['some', 'special', 'things'] for each_entry in list_of_things: print(each_entry) if

Re: [Tutor] Problem in packages

2015-07-01 Thread Flynn, Stephen (L P - IT)
Python version 2.7.10. I have problem in installing .whl format packages. what version of setuptools is required for .whl format packages. I have installed Setuptools version 0.6.0 and upgraded pip to 7.0.3. wndows 7 powershell 1. I tried installing setuptools 18.0 but it is also in .whl

Re: [Tutor] Real world use of recursion

2014-09-10 Thread Flynn, Stephen (L P - IT)
Sorry to bother you all with what you might consider trivia, but someone in my course forum posted this statement: I have never seen or heard of real uses of recursion except for proving cleverness, so I thought I would ask you all if that is true. Is it really not used in real world

[Tutor] sys module - what does It is always available mean in the docs?

2014-08-21 Thread Flynn, Stephen (L P - IT)
The documentation (https://docs.python.org/3/library/sys.html) for Python 3.4.1 says that This module provides access to some variables used or maintained by the interpreter and to functions that interact strongly with the interpreter. It is always available. I interpreted that last sentence as

Re: [Tutor] /tutorial/controlflow.html break statement

2013-12-02 Thread Flynn, Stephen (L P - IT)
The script studied was : for n in range(2, 10): for x in range(2, n): if n % x == 0: print(n, 'equals', x, '*', n//x) break else: print(n, 'is a prime number') The code above is not what you ran below, in idle. Look at the

Re: [Tutor] Scheduling Python Execution

2013-04-15 Thread Flynn, Stephen (L P - IT)
I want to write a twitter bot which runs on a specific time. For an idea, I'd like to have this twitter bot tweet every sunrise and sunset, everyday. Since everyday the sunrise and the sunset time are vary, what are the best way to do it? Have the bot calculate sunrise and sunset for the

Re: [Tutor] How to extract a float from an instancemethod call

2013-04-08 Thread Flynn, Stephen (L P - IT)
Aha - another EdX 6.00 Python course student. Traceback (most recent call last): File /Users/Sydney/Documents/6.00x Files/Problem Sets/ProblemSet7/ps7 copy.py, line 303, in module testRobotMovement(StandardRobot, RectangularRoom) File ps7_verify_movement.py, line 12, in

[Tutor] Python 3.2: processing text files in binary mode, because I want to remove carriage returns and line feeds...

2012-08-23 Thread Flynn, Stephen (L P - IT)
Python 3.2, as in the subject, although I also have 2.7 on this machine too. I have some data which contains text separated with field delimiters (|~) and a record terminator (||) 12345600990|~5229|~990|~0|~4|~1|~2006-09-08|~13:29:39|~some text.|~xxx, x|~||

Re: [Tutor] converting EBCIDIC to ASCII

2012-07-16 Thread Flynn, Stephen (L P - IT)
I am trying to convert an EBCIDIC file to ASCII, when the records are fixed length I can convert it fine, I have some files that are coming in as variable length records, is there a way to convert the file in Python? I tried using no length but then it just reads in to a fixed buffer size and I

Re: [Tutor] converting EBCIDIC to ASCII

2012-07-16 Thread Flynn, Stephen (L P - IT)
-Original Message- From: tutor-bounces+steve.flynn=capita.co...@python.org [mailto:tutor- bounces+steve.flynn=capita.co...@python.org] On Behalf Of Steven D'Aprano Sent: Saturday, July 14, 2012 2:42 AM To: tutor@python.org Subject: Re: [Tutor] converting EBCIDIC to ASCII Prinn,

Re: [Tutor] Simple text file processing using fileinput module. Grabbing successive lines failure

2012-07-03 Thread Flynn, Stephen (L P - IT)
On 02/07/12 18:39, David Rock wrote: Essentially, your problem isn't with using fileinput, it's with how you handle each line that comes in. The immediate problem is with mis-using fileinput. But once you solve that you then have to deal with the other issues David raises. Once more

Re: [Tutor] Simple text file processing using fileinput module.Grabbing successive lines failure

2012-07-03 Thread Flynn, Stephen (L P - IT)
Hi Peter, As you already learned the csv module is the best tool to address your problem. Yup - it's almost going to make my little coding exercise trivial. :) However, I'd like to show a generic way to get an extra item in a for- loop. [snip] Here's a self-contained example: items =

[Tutor] Simple text file processing using fileinput module. Grabbing successive lines failure

2012-07-02 Thread Flynn, Stephen (L P - IT)
Tutors, Whilst having a play around with reading in textfiles and reformatting them I tried to write a python 3.2 script to read a CSV file, looking for any records which were short (indicating that the data may well contain an embedded CR/LF. I've attached a small sample file with a split

Re: [Tutor] Is there space a between #! and /usr/bin/env python ?

2012-05-01 Thread Flynn, Stephen (L P - IT)
I have seen Python manual, it says #! /usr/bin/env python But snippet manager of many text editing programs have #!/usr/bin/env python. Python is a strongly typed language, which one is correct? That's not python code - it's interpreted by the shell (on Linux/Unix) to determine what to invoke

[Tutor] Python 3.2 - difference between out of dir() and help()

2012-03-08 Thread Flynn, Stephen (L P - IT)
Pythonistas, Tinkering around this morning and noticed the following when I created a tuple and asked for a dir() on it and some help() on it. x=('rod','jane','freddy') dir(x) ['__add__', '__class__', '__contains__', '__delattr__', '__doc__', '__eq__', '__format__',

Re: [Tutor] Object designer applications - are there any?

2011-08-05 Thread Flynn, Stephen (L P - IT)
going to be learning python via a project, I might as well do it properly). S. From: Christian Witts [mailto:cwi...@compuscan.co.za] Sent: Friday, August 05, 2011 1:10 PM To: Flynn, Stephen (L P - IT) Cc: Tutor List Subject: Re: [Tutor] Object designer

Re: [Tutor] Object designer applications - are there any?

2011-08-05 Thread Flynn, Stephen (L P - IT)
However, I've not done much OOP at all I'm not sure you need OOP for this. As you say a routine ie a function might be all you need along with some data structures - probably dictionaries to define the translations needed. I suspect you're correct Alan, but as I'm using this an a learning

Re: [Tutor] Excited about python

2011-06-10 Thread Flynn, Stephen (L P - IT)
Python manuals from http://www.python.org/doc/ From: tutor-bounces+steve.flynn=capita.co...@python.org [mailto:tutor-bounces+steve.flynn=capita.co...@python.org] On Behalf Of Kaustubh Pratap chand Sent: Friday, June 10, 2011 1:41 PM To: tutor@python.org

Re: [Tutor] python scripting using ./

2011-05-24 Thread Flynn, Stephen (L P - IT)
What is your Python executable called? You refer to it as python on the command line but your #! line in your script refers to the executable as python3.1. tried it with just python in the #! Line? Check the output of 'ls -al /usr/local/bin/pytho*'... S. -Original Message- From:

Re: [Tutor] python scripting using ./

2011-05-24 Thread Flynn, Stephen (L P - IT)
[mailto:hwilkin...@triad.rr.com] Sent: Tuesday, May 24, 2011 2:25 PM To: Flynn, Stephen (L P - IT) Cc: tutor@python.org Subject: Re: [Tutor] python scripting using ./ John-Wilkinsons-iMac:p31summerfield wilkinson$ ls -al /usr/local/bin/python ls: /usr/local/bin/python: No such file or directory John

Re: [Tutor] can I walk or glob a website?

2011-05-18 Thread Flynn, Stephen (L P - IT)
Pardon the crappy quoting - forced to use Exchange. Top posted too... the shame. What about curl and libcurl? http://curl.haxx.se/ S. -Original Message- From: tutor-bounces+steve.flynn=capita.co...@python.org [mailto:tutor-bounces+steve.flynn=capita.co...@python.org] On Behalf Of Alan

Re: [Tutor] Write new line(enter) in txt

2011-03-28 Thread Flynn, Stephen (L P - IT)
where an end of line is marked via a CR + LF. S. From: Susana Iraiis Delgado Rodriguez [mailto:susana.delgad...@utzmg.edu.mx] Sent: Monday, March 28, 2011 4:28 PM To: Flynn, Stephen (L P - IT) Cc: tutor@python.org Subject: Re: [Tutor] Write new line