Python dictionary : removing u’ chars

Some databases such as Sqlite3 let you define converter and adapter functions so you can retrieve text as str rather than unicode. Unfortunately, MongoDB doesn’t provide this option for any of the commonly needed types such as str, decimal or datetime: http://api.mongodb.org/python/current/tutorial.html#a-note-on-unicode-strings http://api.mongodb.org/python/current/faq.html#how-can-i-store-decimal-decimal-instances http://api.mongodb.org/python/current/faq.html#how-can-i-save-a-datetime-date-instance Having eliminated Mongo options, that leaves writing Python code to do the conversion after the data is retrieved. … Read more

clang error: unknown argument: ‘-mno-fused-madd’ (python package installation failure)

You can tell clang to not raise this as an error by setting the following environment variables prior compilation: Then pip install psycopg2should work. I had the same when trying to pip install lxml. Edit: if you are installing as superuser (which will likely be the case if you are trying to append to /Library/Python/2.7/site-packages, the native Apple … Read more

How do I make a simple crawler in PHP?

Meh. Don’t parse HTML with regexes. Here’s a DOM version inspired by Tatu’s: Edit: I fixed some bugs from Tatu’s version (works with relative URLs now). Edit: I added a new bit of functionality that prevents it from following the same URL twice. Edit: echoing output to STDOUT now so you can redirect it to whatever file you want … Read more