自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(25)
  • 资源 (1)
  • 收藏
  • 关注

转载 正则表达式30分钟入门教程

原文地址:目录跳过目录本文目标如何使用本教程正则表达式到 底是什么东西?入门测试正则表达式元字符字符转义重复字符类分枝条件反义分组后向引用零宽断言负 向零宽断言注释贪婪与懒惰处理选项平衡组/递 归匹配还 有些什么东西没提到联系作者最 后,来点广告……网上的资源及本文参 考文献更新纪录本文目标30分钟内让你明白正则表达式是什么,并对它有一些基本的了解,让你可以

2014-06-11 15:31:37 468

原创 C语言从控制台输入一个字符串,然后赋值给变量

1、常规代码:char name[10];printf("Name: ");scanf("%s", name);

2014-05-08 13:35:22 15505

翻译 为DataGridView 添加复选框,实现全选功能

原文链接:http://www.codeproject.com/Articles/42437/Toggling-the-States-of-all-CheckBoxes-Inside-a-Dat1、 指定DataGridView的第一列为DataGridViewCheckBoxColumn2、 为第一列的标题栏添加一个CheckBox,假设为HeaderCheckBox

2014-03-25 15:05:15 11478

翻译 python21 函数可以返回一些东西

前面的代码中,我们使用=来命名变量,并把字符串或者数据赋值给他。这章,将使用=和python中的return关键字把函数的返回值赋给变量。示例ex21.pydef add(a, b): print "ADDING %d + %d" % (a, b) return a + bdef subtract(a, b): print "SUBTRACTING %d - %

2013-09-20 06:25:20 557

原创 python20 函数和文件

直接上代码,注意下函数是如何与文件相结合ex20.pyfrom sys import argvscript, input_file = argvdef print_all(f): print f.read()def rewind(f): f.seek(0)def print_a_line(line_count, f): print line_count,

2013-09-06 06:19:39 624

翻译 python19 函数和变量

直接上代码ex19.pydef cheese_and_crackers(cheese_count, boxes_of_crackers): print "You have %d cheeses!" % cheese_count print "You have %d boxes of crackers!" % boxes_of_crackers print "Man th

2013-09-06 05:59:24 492

转载 python18 命名、变量、代码、函数

比较大的标题,但这里想用最快的方式介绍一下函数。这里给个最简单的介绍让你可以马上使用它。函数通常做三件事:They name pieces of code the way variables name strings and numbers.They take arguments the way your scripts take argv.利用上述两点,创建你自己的“mini脚本

2013-09-01 07:36:37 1079

翻译 python17 更多文件相关

看下示例,看看python如何复制一个文件,ex17.pyfrom sys import argvfrom os.path import existsscript, from_file, to_file = argvprint "Copying from %s to %s" % (from_file, to_file)# we could do these two on one

2013-08-31 06:50:07 520

原创 python16 文件的读写

close -- Closes the file. Like File->Save.. in your editor.read -- Reads the contents of the file. You can assign the result to a variable.readline -- Reads just one line of a text file.truncate -- Em

2013-08-30 09:26:07 663

翻译 python15 读取文件

1、新建一个ex15_sample.txt文件,内容如下This is stuff I typed into a file.It is really cool stuff.Lots and lots of fun to have in here.2、ex15.pyfrom sys import argvscript, filename = argvtxt = open(

2013-08-29 07:03:29 686

翻译 python14 Prompting and Passing

看到这个标题真不知道怎么翻译,就不翻译。在这个示例里面,把 argv 和 raw_input 一起使用,来达到一些特定的效果代码ex14.pyfrom sys import argvscript, user_name = argvprompt = '> 'print "Hi %s, I'm the %s script." % (user_name, script)pri

2013-08-17 12:43:21 742

翻译 python13 参数、变量、拆包

在这一章中,我们会涉及另一种输入参数的方法。我们可以把变量传给脚本(scrip)。PS:python是一种脚本语言,所以,脚本是*.py文件的另一种说法。看下示例先ex13.pyfrom sys import argvscript, first, second, third = argvprint "The script is called:", scriptprint "Y

2013-08-16 10:42:16 1520

原创 python12 输入提醒

window下,敲命令python -m pydoc raw_input其他系统试下:pydoc raw_input应该可以看到下面这样:raw_input()可以从键盘读取一个字符串。同时可以看到,我们可以在括号里面提示用的字符串。看下代码ex12.py,对上一个代码修改一下age = raw_input("How old are you? ")height

2013-08-15 14:20:20 694

翻译 python11 一些问题

大多数据的软件做以下事情:1、客户端输入一些东西2、软件处理一下输入3、显示那些修改后的东西但是,前面10章讲了大量的打印输出,但是并未涉及任何有关如何从客户端获取输入的内容。示例ex11.pyprint "How old are you?",age = raw_input()print "How tall are you?",height = raw_input()

2013-08-15 13:56:48 516

转载 python10 转义字符

转义字符,当我们要打印某些特殊字符的时候,需要用到转义字符了。看下面表格转义字符内容\\Backslash ()\'Single-quote (')\"Double-quote (")\aASCII bell (BEL)\bASCII backspace (BS)\f

2013-07-31 09:03:22 580

转载 python09 打印,除了打印,还是打印

来源:http://learnpythonthehardway.org/book/ex9.html看下面代码ex9.py# Here's some new strange stuff, remember type it exactly.days = "Mon Tue Wed Thu Fri Sat Sun"months = "Jan\nFeb\nMar\nApr\nMay\nJu

2013-07-20 09:05:50 507

转载 python08 格式化打印

来源:http://learnpythonthehardway.org/book/ex8.html看下代码ex8.pyformatter = "%r %r %r %r"print formatter % (1, 2, 3, 4)print formatter % ("one", "two", "three", "four")print formatter % (True,

2013-07-20 08:59:50 596

转载 python07 更多的打印

来源:http://learnpythonthehardway.org/book/ex7.html看以下代码ex7.pyprint "Mary had a little lamb."print "Its fleece was white as %s." % 'snow'print "And everywhere that Mary went."print "." * 10

2013-07-20 08:54:53 432

原创 python06 字符串和文本

先看一下代码,ex6.pyx = "There are %d types of people." % 10binary = "binary"do_not = "don't"y = "Those who know %s and those who %s." % (binary, do_not)print xprint yprint "I said: %r." % xprint

2013-07-11 09:10:27 472

原创 python05 更多的变量和格式化打印

看一下C语言中的格式化打印int x = 10;printf("I am %d years old.",  x);再看下python的示例ex05.pymy_name = 'Zed A. Shaw'my_age = 35my_height = 74my_weight = 180my_eyes = 'Blue'my_teeth = 'White'my_hair =

2013-07-06 09:15:51 626

原创 python04 变量和变量的命名

我的理解,变量和代数基本上是一个概念。

2013-07-05 14:25:19 563

原创 python03 一些简单的数字运算

+ 加 - 减 / 除 * 乘 % 取模(取余数) 小于> 大于小于等于>=  大于等于print "I will now count my chickens:"print "25 + 30 / 6", 25 + 30 / 6print "Roosters", 100 - 25 * 3 % 4print "Now I will count the eggs:"

2013-07-03 09:39:29 627

原创 python02 注释

python只有一种注释方法:以#号开头,#号后面的都是备注效果等同于C语言中的//注意:1、# -*- coding: utf-8 -*-这是一个例外,python会把它当成代码来处理2、在一个字符串中,#号被当成一个字符而非注释符如:print "7# 汔油又涨价了!"

2013-07-02 15:06:01 447

原创 python01 Hello world!

使用Notepad++新建一个文档ex1.pyprintf "Hello world!"保存打开PowerShell,转到ex1.py所在目录下输入python ex1.py回车第一个程序就这么简单

2013-07-02 13:37:22 492

原创 python的安装

1、去http://notepad-plus-plus.org/下载个Notepad++(个人喜好,不是必须的)2、去http://www.python.org/download/下个Python 2.7.53、打开PowerShell,输入python,按回车这时python可能还不能被识别,因为需要设置一下环境变量4、输入命令[Environment]::SetEnvironm

2013-07-02 13:29:55 474

Spring.NET+NHibernate+NHibernate.Mapping.Attribute自动映射

不喜欢NHibernate传统的*.hbm.xml来对数据库进行映射的朋友有福了,可以使用NHibernate.Mapping.Attribute.dll来实现自动映射。 减少不小的工作量。

2013-05-25

空空如也

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

TA关注的人

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