• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How best to archive in CSV format
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How best to archive in CSV format


  • Subject: Re: How best to archive in CSV format
  • From: Bob Ippolito <email@hidden>
  • Date: Mon, 16 May 2005 22:36:40 -0400


On May 16, 2005, at 10:12 PM, Brian Smith wrote:


On May 17, 2005, at 9:43 AM, Bob Ippolito wrote:


One alternative is to look at PyObjC, because Python ships with a csv module.. though it's not optimal since current versions have a limitation such that it only knows how to deal with bytestrings, not unicode, so you have to encode everything into utf-8 before putting it into the csv and decode it from utf-8 after getting it out.

I've used python to read a csv file and it can't handle mac line endings too, which the files I need to read have. So, with PyObjC, I used NSString's componentsSeparatedByString: method to read the file, so I have found this to be useful, but obviously you have to experiment given on csv files you have. I did have to strip some quote marks from the ends of the array of strings, but I was able to still do it easily with NSString and NSArray methods.

Actually it can read Mac line endings (bare '\r') just fine if you open the file with universal newlines (the 'U' mode). I do this all the time.


-bob

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: How best to archive in CSV format
      • From: Ronald Oussoren <email@hidden>
References: 
 >How best to archive in CSV format (From: Denis Stanton <email@hidden>)
 >Re: How best to archive in CSV format (From: Brian Smith <email@hidden>)
 >Re: How best to archive in CSV format (From: Bob Ippolito <email@hidden>)
 >Re: How best to archive in CSV format (From: Brian Smith <email@hidden>)

  • Prev by Date: Re: Best way to upload a large file (FTP) ...
  • Next by Date: Re: embedding web server in cocoa app
  • Previous by thread: Re: How best to archive in CSV format
  • Next by thread: Re: How best to archive in CSV format
  • Index(es):
    • Date
    • Thread