摘要: Service和act一样,表示可执行程序,单Service是不直接与用户进行交互的,它是一种后台运行组件,如后台数据计算,后台播放音乐等。建立Service有两种方法:一:startService()和stopService()1定义Service类:即在activity通目录下建立一个Servi... 阅读全文
posted @ 2015-05-14 09:51 hitz&x 阅读(187) 评论(0) 推荐(0) 编辑
摘要: Intent意思为意图,就是下一步要做的事情。包括1ComponentName:对象用于表示唯一的长须应用组件,指明了期望的intent组件,即下一步要执行的组件。是activity转换的一种方法。2Action:实际上是intent所触发动作名称的字符串。3Data:主要是对intent消息中的数... 阅读全文
posted @ 2015-05-13 21:28 hitz&x 阅读(241) 评论(0) 推荐(0) 编辑
摘要: 最基本的java文件格式:package com.example.activity;import android.os.Bundle;import android.app.Activity;public class MainActivity extends Activity { @Overri... 阅读全文
posted @ 2015-05-12 16:49 hitz&x 阅读(134) 评论(0) 推荐(0) 编辑
摘要: 驱动按钮有两种方法:1:button1,首先绑定匿名监听,然后重写onClick方法2:button2,在布局文件中设置onClick属性绑定监听,然后在代码中添加对应方法来监听按钮。 package com.example.button;import android.os.Bund... 阅读全文
posted @ 2015-05-12 11:13 hitz&x 阅读(145) 评论(0) 推荐(0) 编辑
摘要: //输入类型定义,text代表所有输入都可以,number只能输入数字 layout main.xml 阅读全文
posted @ 2015-03-31 10:14 hitz&x 阅读(163) 评论(0) 推荐(0) 编辑
摘要: python进行文件读写的函数是open或filefile_handler = open(filename,,mode)Table mode模式描述r以读方式打开文件,可读取文件信息。w以写方式打开文件,可向文件写入信息。如文件存在,则清空该文件,再写入新内容a以追加模式打开文件(即一打开文件,文件... 阅读全文
posted @ 2015-03-29 11:40 hitz&x 阅读(226) 评论(0) 推荐(0) 编辑
摘要: 字符串在Python内部的表示是unicode编码,因此,在做编码转换时,通常需要以unicode作为中间编码,即先将其他编码的字符串解码(decode)成unicode,再从unicode编码(encode)成另一种编码。decode的作用是将其他编码的字符串转换成unicode编码,如str1.... 阅读全文
posted @ 2015-03-27 16:42 hitz&x 阅读(298) 评论(0) 推荐(0) 编辑
摘要: import repattern=re.compile('要匹配的文字')a=pattern.match('被匹配')a# True or Falsefindter方法import rea=re.finter(patrern,strings)#返回一个group对象a,其中按顺序包含了 匹配成功的字... 阅读全文
posted @ 2015-03-25 21:19 hitz&x 阅读(279) 评论(0) 推荐(0) 编辑
摘要: 下载百度贴吧连续几页的帖子# -*- coding: utf-8 -*-"""Created on Sun Mar 22 18:53:43 2015@author: Administrator"""# -*- coding: utf-8 -*-#---------------------------... 阅读全文
posted @ 2015-03-25 19:46 hitz&x 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 10.伪装成浏览器访问 某些网站反感爬虫的到访,于是对爬虫一律拒绝请求 这时候我们需要伪装成浏览器,这可以通过修改http包中的header来实现 headers={'User-Agent':'Mozilla/5.0(Windows;U;WindowsNT6.1;en-US;rv:1.9.1.6)G... 阅读全文
posted @ 2015-03-25 18:38 hitz&x 阅读(130) 评论(0) 推荐(0) 编辑