This file has 1,000,000+ lines in it, yet when I print the counter 'cin'
at EOF I get around 10,000 less lines. Any ideas?
lineIn =
csv.reader(file("rits_feed\\rits_feed_US.csv",'rb' ),delimiter='|')
for emp in lineIn:
cin=cin+1
print cin 3 933
This file has 1,000,000+ lines in it, yet when I print the counter 'cin'
at EOF I get around 10,000 less lines. Any ideas?
lineIn =
csv.reader(file("rits_feed\\rits_feed_US.csv",'rb' ),delimiter='|')
for emp in lineIn:
cin=cin+1
print cin
What happens if you open it in ascii mode rather than binary mode?
-tkc
ken a écrit :
This file has 1,000,000+ lines in it, yet when I print the counter 'cin'
at EOF I get around 10,000 less lines. Any ideas?
Not without seeing the file.
But I'm not sure I want to see it !-)
lineIn =
csv.reader(file("rits_feed\\rits_feed_US.csv",'rb' ),delimiter='|')
for emp in lineIn:
cin=cin+1
print cin
Note that manually tracking line count/number is way too boring. That's
why Python as enumerate(seq) =indice, item
ken wrote:
This file has 1,000,000+ lines in it, yet when I print the counter 'cin'
at EOF I get around 10,000 less lines. Any ideas?
lineIn =
csv.reader(file("rits_feed\\rits_feed_US.csv",'rb' ),delimiter='|')
for emp in lineIn:
cin=cin+1
print cin
My psychic powers indicate that double-quotes in the data are the most
likely source of your problem. You may need to extract some statistics
from the data to find out what's going on without examining each record
individually.
Like, for example, longest field-length for each column.
regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://holdenweb.blogspot.com
Recent Ramblings http://del.icio.us/steve.holden This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Rob Ristroph |
last post by:
Hi,
It's pretty unhelpful to post "I have a huge piece of code that
crashes in strange places, what's the problem?" but that's basically
my problem and I really am at my wit's end.
The piece...
|
by: Paul Drummond |
last post by:
Hi all,
I am developing software for Linux Redhat9 and I have noticed some very
strange behaviour when throwing exceptions within a shared library.
All our exceptions are derived from...
|
by: Neil Ginsberg |
last post by:
I have a strange situation with my Access 2000 database. I have code in the
database which has worked fine for years, and now all of a sudden doesn't
work fine on one or two of my client's...
|
by: TB |
last post by:
I am seeing a very strange problem as follows...
I have a loop where a fair amount of processing is going on and near
the top of the loop I access a class that has only static helper
functions...
|
by: Sam Kong |
last post by:
Hello!
Recently I had a strange problem with Visual C# 2005 beta 1.
When I ran(F5 key) a program, <#if DEBUG> statement was not working.
It ran as RELEASE mode.
So I had to manually define...
|
by: Spam Trap |
last post by:
I am getting strange resizing problems when using an inherited form.
Controls are moving themselves seemingly randomly, but reproducibly.
"frmBase" is my base class (a windows form), and...
|
by: Martin Joergensen |
last post by:
Hi,
I've encountered a really, *really*, REALLY strange error :-)
I have a for-loop and after 8 runs I get strange results...... I
mean: A really strange result....
I'm calculating...
|
by: StephQ |
last post by:
I have a class Bounds with two constructors:
class Bounds
{
private:
list<SegmentupperLinearSpline; // Upper bound.
list<SegmentlowerLinearSpline; // Lower bound.
....
|
by: Dox33 |
last post by:
I ran into a very strange behaviour of raw_input().
I hope somebody can tell me how to fix this.
(Or is this a problem in the python source?)
I will explain the problem by using 3 examples....
|
by: ioni |
last post by:
Good day, fellows!
I have a strange problem – at my site there is a flash strip, that
loads data dynamically.
It works fine (grabs data from the remote server and presents it),
however in IE7...
|
by: Kemmylinns12 |
last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
|
by: antdb |
last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine
In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
|
by: WisdomUfot |
last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
|
by: Oralloy |
last post by:
Hello Folks,
I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA.
My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
|
by: BLUEPANDA |
last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
|
by: Rahul1995seven |
last post by:
Introduction:
In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
|
by: Ricardo de Mila |
last post by:
Dear people, good afternoon...
I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control.
Than I need to discover what...
|
by: Johno34 |
last post by:
I have this click event on my form. It speaks to a Datasheet Subform
Private Sub Command260_Click()
Dim r As DAO.Recordset
Set r = Form_frmABCD.Form.RecordsetClone
r.MoveFirst
Do
If...
|
by: ezappsrUS |
last post by:
Hi,
I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
| |