On 2013-04-22, Colin J. Williams c...@ncf.ca wrote:
Since I'm only interested in one or two columns, the simpler
approach is probably better.
Here's a sketch of how one of my projects handles that situation.
I think the index variables are invaluable documentation, and
make it a bit more
On 23 April 2013 14:36, Neil Cerutti ne...@norwich.edu wrote:
On 2013-04-22, Colin J. Williams c...@ncf.ca wrote:
Since I'm only interested in one or two columns, the simpler
approach is probably better.
Here's a sketch of how one of my projects handles that situation.
I think the index
On 2013-04-23 13:36, Neil Cerutti wrote:
On 2013-04-22, Colin J. Williams c...@ncf.ca wrote:
Since I'm only interested in one or two columns, the simpler
approach is probably better.
Here's a sketch of how one of my projects handles that situation.
I think the index variables are
But a csv.DictReader might still be more efficient.
Depends on what efficiency you care about. The DictReader class is
implemented in Python, and builds a dict for every row. It will never
be more efficient CPU-wise than instantiating the csv.reader type
directly and only doing what you need.
On 2013-04-23 09:30, Tim Chase wrote:
But a csv.DictReader might still be more efficient. I never
tested. This is the only place I've used this optimization.
It's fast enough. ;)
I believe the csv module does all the work at c-level, rather than
as pure Python, so it should be notably
On 21 April 2013 14:15, Colin J. Williams c...@ncf.ca wrote:
In the end, I used:
inData= csv.reader(inFile)
def main():
if ver == '2':
headerLine= inData.next()
else:
headerLine= inData.__next__()
...
for item in inData:
assert len(dataStore) ==
On 2013-04-21, Colin J. Williams c...@ncf.ca wrote:
On 20/04/2013 9:07 PM, Terry Jan Reedy wrote:
On 4/20/2013 8:34 PM, Tim Chase wrote:
In 2.x, the csv.reader() class (and csv.DictReader() class) offered
a .next() method that is absent in 3.x
In Py 3, .next was renamed to .__next__ for
On 22/04/2013 10:42 AM, Neil Cerutti wrote:
On 2013-04-21, Colin J. Williams c...@ncf.ca wrote:
On 20/04/2013 9:07 PM, Terry Jan Reedy wrote:
On 4/20/2013 8:34 PM, Tim Chase wrote:
In 2.x, the csv.reader() class (and csv.DictReader() class) offered
a .next() method that is absent in 3.x
In
On 20/04/2013 9:07 PM, Terry Jan Reedy wrote:
On 4/20/2013 8:34 PM, Tim Chase wrote:
In 2.x, the csv.reader() class (and csv.DictReader() class) offered
a .next() method that is absent in 3.x
In Py 3, .next was renamed to .__next__ for *all* iterators. The
intention is that one iterate with
Colin J. Williams writes:
...
It is not usual to have a name with preceding and following
udserscores,imn user code.
Presumably, there is a rationale for the change from csv.reader.next
to csv.reader.__next__.
...
I think the user code is supposed to be next(csv.reader). For example,
Colin J. Williams wrote:
I was seeking some code that would be acceptable to both Python 2.7 and
3.3.
In the end, I used:
inData= csv.reader(inFile)
def main():
if ver == '2':
headerLine= inData.next()
else:
headerLine= inData.__next__()
...
I
On 21/04/2013 9:39 AM, Jussi Piitulainen wrote:
Colin J. Williams writes:
...
It is not usual to have a name with preceding and following
udserscores,imn user code.
Presumably, there is a rationale for the change from csv.reader.next
to csv.reader.__next__.
...
I think the user code is
On 21/04/2013 9:43 AM, Peter Otten wrote:
Colin J. Williams wrote:
I was seeking some code that would be acceptable to both Python 2.7 and
3.3.
In the end, I used:
inData= csv.reader(inFile)
def main():
if ver == '2':
headerLine= inData.next()
else:
On Sat, Apr 20, 2013 at 4:46 PM, Colin J. Williams c...@ncf.ca wrote:
Below is part of a script which shows the changes made to permit the script
to run on either Python 2.7 or Python 3.2.
I was surprised to see that the CSV next method is no longer available.
Suggestions welcome.
snip
On Sat, 20 Apr 2013 19:46:07 -0400, Colin J. Williams wrote:
Below is part of a script which shows the changes made to permit the
script to run on either Python 2.7 or Python 3.2.
I was surprised to see that the CSV next method is no longer available.
This makes no sense. What's the CSV
On 2013-04-21 00:06, Steven D'Aprano wrote:
On Sat, 20 Apr 2013 19:46:07 -0400, Colin J. Williams wrote:
Below is part of a script which shows the changes made to permit
the script to run on either Python 2.7 or Python 3.2.
I was surprised to see that the CSV next method is no longer
On 4/20/2013 8:34 PM, Tim Chase wrote:
In 2.x, the csv.reader() class (and csv.DictReader() class) offered
a .next() method that is absent in 3.x
In Py 3, .next was renamed to .__next__ for *all* iterators. The
intention is that one iterate with for item in iterable or use builtin
functions
17 matches
Mail list logo