- when you paste your python code into vim, the indent will be crazy. but if you run the command in the normal mode first:
:set paste
Everything will be fine.
import datetime
start = datetime.datetime.now()
# some time later
end = datetiem.datetime.now()
second_delta = (end - start).total_seconds()
MongoDB Query by ObjectId:
from bson.objectid import ObjectId
import pymongo
handler = pymongo.MongoClient().xx.yy
handler.update({'_id': ObjectId('asdfasd24234asdf8ajk')}, {'$set': {'aa': 1}})
from scrapy.selector import Selector
selector = Selector(text='<html>.....</html>')
change the size of figure and x label:
matplotlib.rcParams['figure.figsize'] = (20.0, 15.0)
matplotlib.rc('xtick', labelsize=20)