#!/usr/bin/python
#coding=utf- #urllib2是python自带的模块,在python3.x中被改为urllib.request
import urllib.request
import re page = urllib.request.urlopen('http://www.baidu.com')
html = page.read().decode('utf-8')
# Python3 findall数据类型用bytes类型
# or html=urllib.urlopen(url).read() title=re.findall('<title>(.+)</title>',html)
print (title)

Python 获取页面title的更多相关文章

  1. Python3 Selenium WebDriver网页的前进、后退、刷新、最大化、获取窗口位置、设置窗口大小、获取页面title、获取网页源码、获取Url等基本操作

    Python3 Selenium WebDriver网页的前进.后退.刷新.最大化.获取窗口位置.设置窗口大小.获取页面title.获取网页源码.获取Url等基本操作 通过selenium webdr ...

  2. Selenium WebDriver-网页的前进、后退、刷新、最大化、获取窗口位置、设置窗口大小、获取页面title、获取网页源码、获取Url等基本操作

    通过selenium webdriver操作网页前进.后退.刷新.最大化.获取窗口位置.设置窗口大小.获取页面title.获取网页源码.获取Url等基本操作 from selenium import ...

  3. python获取页面文字信息

    # -*- coding: utf- -*- from selenium import webdriver import time, re,requests,os,time,random,traceb ...

  4. (转)用python获取页面返回的cookie

    网址如下: crifan:http://www.crifan.com/get_cookie_from_web_response_in_python/ . . . .

  5. Python+Selenium自动化-获取页面信息

    Python+Selenium自动化-获取页面信息   1.获取页面title title:获取当前页面的标题显示的字段 from selenium import webdriver import t ...

  6. selenium常用的API(三)获取网页title、html源码

    获取网页title 获取页面title的方法可以直接用driver.title获取到,然后可以把获取到的结果用做断言. #encoding=utf-8 from selenium import web ...

  7. selenium_webdriver(python)获取元素属性值,浏览器窗口控制、网页前进后退,title/url打印

    <span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-s ...

  8. 利用Python获取统计自己的qq群成员信息

    利用python获取自己的qq群成员信息! 首先说明一下需要使用的工具以及技术:python3 + selenium selenium安装方法:pip install selenium 前提:获取自己 ...

  9. 利用python获取自己的qq群成员信息

    利用python获取自己的qq群成员信息! 首先说明一下需要使用的工具以及技术:python3 + selenium selenium安装方法:pip install selenium 前提:获取自己 ...

随机推荐

  1. Golang JSON操作汇总

    直接把结构体编码成json数据 package main import ( "encoding/json" "fmt" _ "os" ) t ...

  2. 利用wxpython显示OpenCV图像

    核心代码 import wx, cv2 import numpy as np # Start with a numpy array style image I'll call "source ...

  3. 【tensorflow】tensorflow学习记录——安装、第一个程序篇

    机器学习,人工智能往后肯定是一个趋势,现阶段有必要研究一两个人工智能的工具,以免自己技术落伍,其中tensorflow就是一个很不错的项目,有谷歌开发后开源,下面开始学习安装和使用 安装篇: 很不幸, ...

  4. ruby 字符串

    字符串处理函数 1.返回字符串的长度 str.length => integer 2.判断字符串中是否包含另一个串 str.include? other_str => true or fa ...

  5. Database: index

    The whole point of having an index is to speed up search queries by essentially cutting down the num ...

  6. Linux系统资源查看与设置

    /proc/sys/fs/file-max = 65536 /proc/sys/net/ipv4/tcp_fin_timeout = 15 /proc/sys/net/ipv4/tcp_tw_recy ...

  7. 高通MSM8255 GPS 调试分析&&Android系统之Broadcom GPS 移植【转】

    本文转载自:http://blog.csdn.net/gabbzang/article/details/12063031 http://blog.csdn.NET/dwyane_zhang/artic ...

  8. CodeForces - 552E Vanya and Brackets —— 加与乘运算的组合

    题目链接:https://vjudge.net/contest/224393#problem/E Vanya is doing his maths homework. He has an expres ...

  9. jumpserver v3.0

    文档地址 www.php230.com/weixin1451347094.html

  10. django model中get()和filter()方法的区别

    django的get()方法是从数据库的取得一个匹配的结果,返回一个对象,如果记录不存在的话,它会报错. django的filter()方法是从数据库的取得匹配的结果,返回一个对象列表,如果记录不存在 ...