zoukankan      html  css  js  c++  java
  • python安装

    wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tgz

    cd Python-3.5.2

    ./configure --prefix=/usr/local/python3.5.2

    make -j4 && make install

    vi ~/.bash_profile

    + /usr/local/python3.5.2/bin

    . ~/.bash_profile

    mysql:

    yum install MySQL-python

    import MySQLdb

    python 小程序

    #coding=utf-8
    import MySQLdb
    
    conn= MySQLdb.connect(
            host='localhost',
            port = 3306,
            user='root',
            passwd='Hisoft@1',
            db ='test',
            )
    cur = conn.cursor()
    
    #创建数据表
    #cur.execute("create table student(id int ,name varchar(20),class varchar(30),age varchar(10))")
    
    #插入一条数据
    cur.execute("insert into account(name,passwd) values('test','passwd')")
    
    
    #修改查询条件的数据
    #cur.execute("update student set class='3 year 1 class' where name = 'Tom'")
    
    #删除查询条件的数据
    #cur.execute("delete from account where id='9'")
    
    #获得表中有多少条数据
    aa=cur.execute("select * from account")
    print aa
    
    #打印表中的多少数据
    info = cur.fetchmany(aa)
    for ii in info:
        print ii
    
    cur.close()
    conn.commit()
    conn.close()
    

      

  • 相关阅读:
    HTML页引用CSS
    C#反射
    Marshal.SecureStringToBSTR
    SQL语句创建表和数据库
    抽象类和抽象方法
    3 Sum Closest
    Chapter 2: Binary Search & Sorted Array
    Spiral Matrix
    Pascal's Triangle
    Plus One
  • 原文地址:https://www.cnblogs.com/nowphp/p/5924312.html
Copyright © 2011-2022 走看看