I second this, the SF Public Libraries are a great place to work. I used to work out of the Potrero Hill branch a lot.
The main library (the one by the Civic Center) closes way later than the rest. Good spot if you're working alone.
The main library (the one by the Civic Center) closes way later than the rest. Good spot if you're working alone.