CSV to Browser Bookmark file

Skip Montanaro skip at pobox.com
Wed Mar 31 09:11:36 EST 2004


>>>>> "Bill" == Bill  <billb at isp.net.au> writes:

    Bill> I currently have all of my Bookmarks under WinXP in a PIM, which
    Bill> will allow me to export them as a CSV file ( fields are
    Bill> "Category,Page-Title,URL,Comments - all fields of no fixed
    Bill> length).

    Bill> Is there a program/script that will output the info from csv to a
    Bill> browser bookmark file - Any browser as I want to move the
    Bill> bookmarks from Windows to Linux - unfortunately the PIM wont run
    Bill> under Wine in Linux and I am not a programmer so I have no idea
    Bill> how to convert the file.

I don't know what your output format is supposed to look like, but reading
the input CSV file is trivial.  Assuming it's named "mybookmarks.csv", you
can read it and emit some HTML fragments using something like this:

    import csv

    rdr = csv.DictReader(file("mybookmarks.csv"))
    for row in rdr:
        print '<a href="%(URL)s">%(Page-Title)s</a>' % row

There's going to be more to the output side of things than that.  Save your
browser's bookmarks as an HTML file and look at it for hints of what other
print statements you need.

Skip




More information about the Python-list mailing list