2014年7月

Python基础入门笔记

 1.数据类型:Numbers(数字) 支持int long float complex
             String(字符串)
             List(列表)----[]  使用最频繁
             Tuple(元组)----() 不能二次赋值,相当于只读列表
             Dictionary(字典)----{} 由索引(key)和它对应的值value,类似于数组
        这些规则以字符串为例,List 和 Tuple 类似:
    ①从左到右索引默认0开始的,最大范围是字符串长度少1
    ②从右到左索引默认-1开始的,最大范围是字符串开头
    ③print str[2:5] # 输出字符串中第三个至第五个之间的字符串
    ④加号(+)是列表连接运算符,星号(*)是重复操作
 2.运算符:
              ** 幂
              // 取整除 商的整数部分
              == 等于 - 比较对象是否相等
              += 加等于
              and  与
              or   或
              not  非
              in  如果在指定的序列中找到值返回True,否则返回False。
              not in
              is   is是判断两个标识符是不是引用自一个对象
              is not
  3.输出:
        a = “Hello”
        b=2
        print a
        print "This s a information :%s %d" %(a,b)
 4.条件语句:
            ① num=5
              if num==2:
                 print 'Y'
              elif num==3:
                 print 'N'
              elif num==4:
                 print '4'
              else:
                 print 'nosense'
            ② num=5
              if num==5:print 'Y'
  5.循环语句:
            ①while:
                   num=0
                   while(num<9):
                       print 'The num is :',num
                       num+=1
                   else:
                        print 'over'
            ②for:
                   for letter in 'python':
                       print "The current letter is",letter
                       if letter=='t':break;
                   print 'Over'
            ③continue 语句跳出本次循环,而break跳出整个循环。
  6.函数:
            def printinfo(name,age):
              print "This is a printed message!"
              print name
              print age
            printinfo("xie",20)
  7.面向对象:
            ①构造函数:__init__
            def __init__(self,name,salary):
                self.name=name
                self.salary=salary
                Employee.empCount+=1
            ②类方法要带上的一个变量:照惯例它的名称是self。
            ③继承:
            class Child(Parent): # define child class

JQuery学习笔记

1.页面加载即执行:$(document).ready(
function(){
});
2.点击触发事件:$(".name/ #name").click(function(){

});
3.向下遍历找到:
find():var name = document.getElementById("form")

.find("#forname");

4.值:
name.val()
5.隐藏:
hidden()
显示:show()--由隐藏到显示
6.插入内容:
find("#form").prepend("html代码")
7.长度:
.size() 返回长度
.length() 长度
8.判断提交是否为数字:isNumeric()

9.与服务器联系post方法

$('#post').click(function(){
$.post("url路径",
{
//传送的数据
},
function(data,status){
//返回data 和状态
});

});
});