954,515 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

CSV Files, I/O and Empty Values

I am starting to try and manipulate some CSV file data.

My first problem is the empty values (empty cells in a spread sheet). My boss sends me these files and when I open the in csv format Python gives me:

"Denison, P14, , , , , $1600"

I can't find if there is a few simple lines of code (or whatever it may be) that would only output my CSV data as strings and mathematiccal expressions while omitting blank values.

Much Thanks!

zurk91
Newbie Poster
1 post since Dec 2011
Reputation Points: 10
Solved Threads: 0
 

Have a look at the built-in split() method. It will allow you to create a list composed of the values you need - http://www.tutorialspoint.com/python/string_split.htm

to check if an indexed item is empty, you could try checking if item == " "
Good luck.

valorien
Newbie Poster
19 posts since Apr 2008
Reputation Points: 23
Solved Threads: 5
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: