自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Jack_Li

编程技术

  • 博客(98)
  • 资源 (4)
  • 收藏
  • 关注

原创 wxPython中Button的使用方法

#!/usr/bin/python#-*- coding:utf8 -*-#主要讲讲button的使用import wxclass ButtonFrame(wx.Frame):    def __init__(self, root):        wx.Frame.__init__(self, None, -1, u"按钮", size=(300, 100))

2014-09-30 11:44:48 10110

原创 条件测试

1.有时要判断字符串是否相等,可能还要检查文件状态或是数字测试。基于这些测试才能做进一步动作。 Test命令用于测试字符串,文件状态和数字2.文件测试test文件测试一般有两种格式1) test condition2) [ condition ]  #使用括号时  注意两边加上空格-d   目录-f   正规文件-L   符号链接文件-r   可读文件-

2014-09-29 17:15:33 568

原创 wxPython的使用1

#!/usr/bin/python#-*- coding:utf8 -*-#C/C++程序员一般都喜欢用wxPython, QtPython等作为python的界面#现在主要讲讲wxPython吧import  wx   #导入界面库class Window(wx.Frame):  #窗体的自定义    def __init__(self, root):

2014-09-29 16:45:49 852

原创 python 界面库的简单使用

#!/usr/bin/python#-*- coding:utf8 -*-from Tkinter import *class Window:    def __init__(self, root):        frame = Frame(root)        frame.pack()   #进行调整        self.okBtn = Button

2014-09-28 11:28:02 3458

原创 python操作数据库

#!/usr/bin/python#-*- coding:utf8 -*-#主要演示python操作mysql数据库#首先建立数据库#数据库的基本操作就不说了#create table Student#(#   number int primary key,#   name char(10) not null,#   age int,#   sex ch

2014-09-27 20:53:41 440

原创 shell变量

shell变量2.本地变量: 本地变量在用户现在的shell生命期的脚本中使用    local_test="Ths is a test from jack"    echo $local_test(变量替换)  variable-name=value  set 显示本地所有的变量 readonly variable-name #表示是只读的 rea

2014-09-27 20:07:54 417

原创 python异常

#!/usr/bin/python#-*- coding:utf8 -*-#简单的文件异常try:    file("Jack.txt", "w+")    print "write file"except IOError:    print "the file can't be written"except:    print "except"

2014-09-27 10:32:23 483

原创 python类的使用3

#!/usr/bin/python#-*- coding:utf8 -*-#将将Init函数中弗雷的初始化class Student(object):    def __init__(self, name):        print "student name is: ",nameclass SmallStudent(Student):    def __in

2014-09-24 12:57:45 510

原创 登录环境

登录系统时,在进入命令提示符前,系统要做两个工作。键入用户名和密码后,系统检查是否为有效用户,为此需查询/etc/passwd文件。如果登录名正确并且密码有效,开始下一步过程,即登录环境。1.首先来看看/etc/passwd文件用户名:加密的口令:UID:GID:用户的全名或者描述:主目录:登录的shelldaemon:x:1:1:daemon:/usr/sbin:/bin/s

2014-09-23 20:23:31 730

原创 python类的使用2

#!/usr/bin/python#-*- coding:utf8 -*-import gcclass Student:    def __init__(self, name="", age=""):        self._name = name        self._age = age        #print self._name    d

2014-09-23 10:37:11 435

原创 python类的介绍1

#!/usr/bin/python#-*- coding:utf8 -*-class Student:    name = ""    sex = "F"    def __init__(self):        self.name = "Hello"  #默认的是Hello    def setName(self, name):        self.

2014-09-22 23:11:35 449

原创 输入输出 字节,字符流

#!/usr/bin/python#-*- coding:utf8 -*-import syssys.stdout = open("Jack.txt", "w+")print "Hello"sys.stdout.close()#创建文件并斜写入数据#sys.stdin = open("test1.txt", "r")#for line in sy

2014-09-22 21:27:15 534

原创 配置文件以及目录遍历

#/usr/bin/python#-*- coding:utf8 -*-import difflibimport osf1 = open("test1.txt", "r")f2 = open("test2.txt", "r")src = f1.read()dst = f2.read()print srcprint dstf1.close(

2014-09-22 13:44:45 785

原创 引号

在脚本中执行变量替换时最容易犯的一个错误就是由于引用错误。类型:""          双引号''        单引号`        反引号\        反斜线1.双引号使用双引号可引用除字符 $、`、\外的任意字符或字符串。这些特殊字符分别为美元符号,反引号和反斜线,对shell来说,它们有特殊意义。如果使用双引号将字符串赋给变量并反馈它,实际

2014-09-22 13:24:43 692

转载 我喜欢的九句话

1.你处理情绪的速度, 就是你乃向成功的速度2.人的一切痛苦,本质上都是, 对自己无能的愤怒3.只有经历最痛苦的坚持, 才配得上最长久的幸福4.记住一句话 “越努力 越幸福”5.一个人越慵懒,明天做的是越多6.你的负担,将变成礼物 你受的苦,将照亮你的路7.能让你倒下的 不是对手,而是你绝望的内心8.任何值得去的地方,都没有捷径9.请

2014-09-21 13:10:31 485

原创 八个硬币中找假

#include using namespace std;#include    //用于随机产生的硬币重量#include const int N = 8;int calCoin(int *arr);int main(){    int* arr = new int[N];    for(int i=0; i    {        arr

2014-09-21 12:00:02 726

原创 tr命令的使用

1.tr用来从标准输入中通过替换或删除操作进行字符转换。tr主要用于删除文件中控制字符或进行字符转换。使用tr时要转换两个字符串:字符串1用于查询,字符串2用于处理各种转换。tr刚执行时,字符串 1中的字符被映射到字符串2中的字符,然后转换操作开始。2.tr[-c/-d/-s] str1 str2 file  tr一般使用的选项有: -c, -d, -s -c: 用字符串1中字

2014-09-21 11:06:03 929

原创 文件的一些基础操作(创建,复制,拷贝,查找)

#!/usr/bin/python#-*- coding:utf8 -*-import osimport re#进行文件的删除file("jack.txt", "w+")#可以看见当前文件夹下有意个jack.txt文件#进行文件的删除if os.path.exists("jack.txt"):    os.remove("jack.txt")#没有j

2014-09-21 10:51:46 642

原创 文件的读写操作

#!/usr/bin/python#-*- coding:utf8 -*-#这一章主要介绍文件以及操作import os#创建文件 并写入数据write_context = """    This is a test from jack"""f = file("jack.txt", "w")f.write(write_context)f.cl

2014-09-20 19:06:27 546

原创 join,sort等命令

.join的用法join用来将来自两个分类文本文件的行连在一起。如果学过 S Q L语言,可能会很熟悉join命令。join的一般格式为:join [option] input-file1 input-file2an      n 为一数字,用于连接时从文件n中显示不匹配行。例如,-a1显示第一个文件的不匹配行,-a2为从第二个文件中显示不匹配行。o n.m    n

2014-09-18 10:34:55 726

原创 正则表达式的应用

#!/usr/bin/python#-*- coding:utf8 -*-import re#现在讲讲正则表达式#这是一种字符串的高级语法规则string = "Hello, This is a test from jack"#首先匹配头部 Hello#使用^print re.findall(r"^Hello",string)print re.f

2014-09-18 09:49:21 499

原创 sort和uniq命令

1.sort的使用:sort命令将许多不同的域按不同的列顺序分类。当查阅注册文件或为另一用户对下载文件重排文本列时,sort工具很方便。实际上,使用其他UNIX工具时,已假定工作文件已经被分过类。无论如何,分类文件比不分类文件看起来更有意义。sort命令的一般格式为:   sort -cmu -o output_file [other options] +pos1 +pos2 inpu

2014-09-17 23:05:41 776

原创 mysql的使用24

mysql> #自适应哈希索引mysql> #自适应哈西索引采用之前讨论的三列表的方式实现mysql> #查看当前自适应哈西索引的使用情况mysql> show engine innodb status;+--------+------+-------------------------------------------------------------------------

2014-09-17 10:27:00 597

原创 mysql的使用25

mysql> create table listPart(    -> a int,b int)engine=innodb    -> partition p0values in (1,3,5,7,9),    -> partition p0values in (0,2,4,6,8));ERROR 1064 (42000): You have an error in your SQ

2014-09-17 10:25:48 1622

原创 mysql的使用22

mysql> use test;Reading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -ADatabase changedmysql> #MyISAM存储引擎其实更像一整堆表,所有的

2014-09-17 10:24:55 476

原创 mysql的使用21

mysql> use test;Reading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -ADatabase changedmysql> #隔离级别mysql> #如果用户想要在m

2014-09-17 10:24:12 467

原创 mysql的使用23

mysql> #联合索引mysql> #是指对表上的多个列进行索引,联合索引的创建方法与单个索引的创建方法一样,不同之处仅在于多个所以列mysql> create table indext(a int, b int, primary key(a), key idx_a_b(a,b))engine=innodb;ERROR 1046 (3D000): No database select

2014-09-17 10:23:41 515

原创 mysql的使用20

mysql> #事务  是数据库区别于文件系统的重要特性之一   mysql> #在sql编程中 事务编程成为必不可少的一个部分,事务能够保证数据从一种一致状态转化为另一种状态mysql> #在数据库提交时  可以确保其要么对所有的修改都已经保存 要么对所有的操作都不保存mysql> #事务是访问并更新数据库中各种数据库项的一个程序执行单元mysql> #原子性:是指整个数据库事务

2014-09-17 10:23:26 543

原创 mysql的使用19

mysql> use test;Reading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -ADatabase changedmysql> #rollupmysql> #rollup

2014-09-17 10:22:22 921

原创 mysql的使用18

mysql> use test;Reading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -ADatabase changedmysql> #pivotingmysql> #pivo

2014-09-17 10:21:03 473

原创 mysql的使用17

mysql> use test;Reading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -ADatabase changedmysql> #刚才插入有问题哈mysql> mys

2014-09-17 10:20:11 448

原创 mysql的使用16

mysql> use test;Reading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -ADatabase changedmysql> show tables;+--------

2014-09-17 10:19:25 420

原创 mysql的使用15

mysql> #滑动订单问题mysql> create table MonthlyOrders    -> (    -> ordermonth date primary key    -> ordernum int unsigned    -> );ERROR 1046 (3D000): No database selectedmysql> use test;Re

2014-09-17 10:16:42 518

原创 字符串操作大全

#!/usr/bin/python#-*- coding:utf8 -*-#本章主要讲下字符串的操作#首先介绍字符串的格式化str1 = "Jack"str2 = "WJin"print "%s "% str1print "%s ^_^ %s" % (str1, str2)print "关于小数: %f--%.1f--%.2f" % (1.35, 1.35,

2014-09-17 10:15:24 470

原创 swap交换区改变大小

1.首先你用free命令 查看下Swap的交换空间有多少(这里是以K为单位的)或者用free -m 查看是以MB 为单位的(man free)2.现在来修改Swap的大小(以下操作我是以管理员权限做的)****#mkdir change****#cd change**change# dd if =/dev/zero of=swap bs=1024 count=400

2014-09-16 21:26:21 1050

原创 mysql的使用14

mysql> use test;Reading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -ADatabase changedmysql> show tables;+--------

2014-09-16 21:08:05 584

原创 mysql的使用13

mysql> show tables;+----------------+| Tables_in_test |+----------------+| Nums           || a              || animals        || charTest       || customers      || dept_manager   |

2014-09-16 20:49:57 447

原创 mysql的使用12

mysql> create table dept_manager(    -> dept_no varchar(10) primary key not null,    -> emp_no int not null,    -> birth_date date,    -> worktime date);Query OK, 0 rows affected (0.10 sec)

2014-09-16 20:48:56 483

原创 mysql的使用11

mysql> #exists是一个非常强大的谓词 它允许数据库高效的检查指定查询是否产生某些行mysql> #通常exists的输入是一个子查询 并关联到外部查询mysql> use test;Reading table information for completion of table and column namesYou can turn off this feature

2014-09-16 20:48:00 470

原创 module的简单使用

module.py#!/usr/bin/python#-*- coding:utf8 -*-#首先在此处定义函数  在别的.py文件中调用def addFunc(x,y):    return x+ydef delFunc(x,y):    return x-ydef mulFUnc(x,y):    return x*ydef divF

2014-09-16 20:46:37 563

命名管道技术

这是一篇关于管道技术的文章,觉得非常有用就直接拿过来了

2013-10-26

贪吃蛇源码

贪吃蛇源码 对于一些出学者有一些帮助 掌握语言

2013-09-21

半透明窗体

对于透明窗体的建立有点帮助 对于初学者能够有一些帮助

2013-09-21

多线程技术

多线程的一些介绍 对于初学者能够有一些引导作用

2013-09-21

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除