Python cheasheet

less than 1 minute read

Get content of URL

import urllib2
print urllib2.urlopen('http://google.com').read()

Remove chars and split by , from a string convert to list

'jshfjshfjsh[]'.translate(None, '[] "\n').split(',')

Diff between two arrays

set(['first', 'second', 'third']) - set(['first', 'second'])

Categories: , ,

Updated:

Leave a Comment