This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.jsoup.safety.*; | |
| import org.jsoup.examples.*; | |
| import org.jsoup.helper.*; | |
| import org.jsoup.*; | |
| import org.jsoup.parser.*; | |
| import org.jsoup.select.*; | |
| import org.jsoup.nodes.*; | |
| Document doc = null; | |
| try { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| data:image/svg+xml;charset=utf-8'+encodeURIComponent(svg) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| \copy ( | |
| select * | |
| from table1 left join table2 on table1.id = table2.id | |
| ) To '/Path/to/heaven/machin.csv' With CSV; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import urllib | |
| import urllib2 | |
| headers = {"Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", | |
| "Accept-Charset":"ISO-8859-1,utf-8;q=0.7,*;q=0.3", | |
| "Accept-Language":"fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4", | |
| "User-Agent":"Your Very Own Robot"} | |
| baseUrl = "http://query.yahooapis.com/v1/public/" | |
| urlPattern = "yql?%s" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import json | |
| dataJson = '{"title":"json example", "content":[{"number":"1", "key":"value"}, {"number":"2", "key":"another value"}]}' | |
| data = json.loads(dataJson) | |
| print json.dumps(data, sort_keys=True, indent=4, separators=(',', ': ')) | |
| print data['title'] | |
| for content in data['content']: | |
| for key in content: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from lxml import etree | |
| data = "<html>" | |
| data += "<head>" | |
| data += "<title>I love python</title>" | |
| data += "</head>" | |
| data += "<body>" | |
| data += "<p class='language'><span id='good-rating'>good!</span> python</pp><br />" | |
| data += "<p class='language'><span id='hard-rating'>hard!</span>lisp</p>" | |
| data += "<p class='editor'>CodeRunner for mac os x is very useful</p>" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import urllib, urllib2 | |
| dataStream = urllib.urlopen("http://www.google.com") | |
| data = dataStream.read() | |
| print data |