自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(11)
  • 收藏
  • 关注

原创 python每日学习---r

在python中,我们经常会在print中看到这样的格式:print r"hello\n"其实,这里的r就是禁止转义用的,所以,最终的输出结果是: hello\n 而print "hello\n" 则会输出的是 hello换行 这个经常会用在正则的地方,因为正则的时候经常需要使用到需要转义的地方 举个之前的例子:result_serch = re.search(r'custom\.sh['

2016-09-08 21:58:13 257

转载 python模块--random

学习收藏了下关于Python中的random模块相关的知识:如果你已经了解伪随机数(psudo-random number)的原理,那么你可以使用如下:random.seed(x)来改变随机数生成器的种子seed。如果你不了解其原理,你不必特别去设定seed,Python会帮你选择seed。1) 随机挑选和排序random.choice(seq) # 从序列的元素中随机挑选一个元素,比如rand

2016-02-15 10:30:34 305

原创 Python之 with and as

The ‘with’ and ‘as’ Keywords Programming is all about getting the computer to do the work. Is there a way to get Python to automatically close our files for us?Of course there is. This is Python.You m

2016-01-26 16:28:21 404

原创 python 之 readline

What if we want to read from a file line by line, rather than pulling the entire file in at once. Thankfully, Python includes a readline() function that does exactly that.If you open a file and call .r

2016-01-26 15:56:47 469

原创 Python之I/O

my_list = [i**2 for i in range(1,11)] # Generates a list of squares of the numbers 1 - 10f = open("output.txt", "w") ##Open output.txt in w modefor item in my_list: f.write(str(item) + "\n")f.close

2016-01-26 15:35:55 461

原创 class 之 ___repr__

When defining a new repr(), return a string value that uses the member variables of the class to display the 3D point properly. You can use the str() function to put these numbers in the proper string.

2016-01-26 15:10:29 189

原创 python 之class (Overriding methods)

Overriding methods Since our ElectricCar is a more specialized type of Car, we can give the ElectricCar its own drive_car() method that has different functionality than the original Car class’s.题目: I

2016-01-25 18:02:27 657

原创 python 学习之---class (inheritance)

因为工作需要,一大把年纪还得开始学习python,哎,是在不容易,如何入手呢,根据牛人的经验,找本书看看,最基础的还是看了codecademy上的习题,内容简单,有提示,实在不行,还有google,还是挺好的,现在,只是想把一些自己的理解记录下来,以供自己日后借鉴:class:题目: Create a class ElectricCar that inherits from Car. Give y

2016-01-25 15:22:44 653

转载 文章标题

from math import sqrt def sqrt (number): sqrts = sqrt(number) print sqrts

2015-11-23 16:51:02 146

转载 python 学习 (type)

type可以返回执行的类型 eg: print type (42) print type ("42")

2015-11-23 16:42:28 147

原创 欢迎使用CSDN-markdown编辑器

欢迎使用Markdown编辑器写博客本Markdown编辑器使用StackEdit修改而来,用它写博客,将会带来全新的体验哦: Markdown和扩展Markdown简洁的语法 代码块高亮 图片链接和图片上传 LaTex数学公式 UML序列图和流程图 离线写博客 导入导出Markdown文件 丰富的快捷键 快捷键 加粗 Ctrl + B 斜体 Ctrl + I 引用 Ctrl

2015-10-09 15:02:12 156

空空如也

空空如也

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

TA关注的人

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