Skip to content

Instantly share code, notes, and snippets.

@karthik
Created April 29, 2014 18:24
Show Gist options
  • Save karthik/11408151 to your computer and use it in GitHub Desktop.
Save karthik/11408151 to your computer and use it in GitHub Desktop.
Pherobase exampel
Display the source blob
Display the rendered blob
Raw
{
"metadata": {
"name": "",
"signature": "sha256:febfb60762ef194ea819de385744eda5e0cb408b17978f1e9d858b18a55d6b55"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
"collapsed": false,
"input": [
"from bs4 import BeautifulSoup\n",
"import urllib2\n",
"url=\"http://www.pherobase.com/database/genus/genus-Parhypochthonius.php\"\n",
"page=urllib2.urlopen(url)\n",
"soup = BeautifulSoup(page.read())"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 10
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"soup.title"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 12,
"text": [
"<title>Parhypochthonius</title>"
]
}
],
"prompt_number": 12
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"soup.title.name"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 13,
"text": [
"'title'"
]
}
],
"prompt_number": 13
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"soup.title.string"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "pyout",
"prompt_number": 14,
"text": [
"u'Parhypochthonius'"
]
}
],
"prompt_number": 14
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"metadata": {},
"outputs": []
}
],
"metadata": {}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment