自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

转载 批量注释 control+/

批量注释 control+/You can comment and uncomment lines of code using Ctrl+斜杠.Ctrl+斜杠 comments or uncomments the current line or several selected lines with single line comments ({# in Django templat...

2018-05-13 17:26:00 196

转载 TypeError: 'list' object cannot be interpreted as an integer

TypeError: 'list' object cannot be interpreted as an integer类型错误,不能将list对象转换为一个整数.错误代码,例如如下例子:args=[3,6]print(list(range(args)))range函数本应该需求,一个整数,或者一对范围,或者三个整数类型,才能构造一个it...

2018-04-22 18:46:00 20343

转载 表达式语句

  在Python中,可以使用表达式作为语句(本身只占一行)。但是,因为表达式结果不会存储,只有当表达式工作并作为附加的效果,这样才有意义。通常只有两种情况下表达式作为语句。调用函数和方法:  有些函数和方法会做很多工作,而不会有返回值。这种函数在其他语言中有时称为过程。因为他们不会返回你可能想保留的值,所以你可以用表达式语句调用这些函数。在交互模式提示符下打印值:  P...

2018-04-14 22:16:00 115

转载 (h,v) represent (horizontal,vertical)

函数名h,v 代表 行和列 (horizontal,vertical)numpy 中 hstack 表示横向拼接两个行数相同的数组In [42]: np.hstack((arr3,arr4))Out[42]:array([[ 0, 0, 0, 3, 1, 2, 3, 4],[ 5, 8, 13, 21, 5, 6...

2018-04-12 18:03:00 282

转载 创建字典方法

{‘name‘:’mike’,’age’:55}D={}D[‘name’]=‘mike’D[‘age’]=55dict(name=‘mike’,age=55)dict([(‘name’,’mike’),(‘age’,55)])转载于:https://www.cnblogs.com/wawawawa-briefnote/p/8747908.html...

2018-04-08 22:20:00 222

转载 vars()

返回一个字典,包含所有在本函数调用时存在的变量转载于:https://www.cnblogs.com/wawawawa-briefnote/p/8747510.html

2018-04-08 21:09:00 65

转载 字符串格式化表达

%s 需格式化转换为字符串,所有对象类型都可以转换为字符串类型%d 十进制整数%f 浮点数%[(name)] [(flags)] [(width)] [.precision] typecode # %和字符吗之间可以:放一个字典的键 左对齐(-) 正负号(+) 补零(0)转载于:https://www.cnblogs.com/w...

2018-04-08 21:00:00 114

转载 notes

>>> a=23414>>> a += 123>>> a23537##--------------------------------------------------------------------->>> prompt = "If you tell us who you are, we can person...

2018-04-02 22:53:00 73

转载 Pycharm常见快捷键

Ctrl+/注释(取消注释)选择的行Shift + Enter开始新行Ctrl + Enter智能换行TAB Shift+TAB缩进/取消缩进所选择的行Ctrl + Alt + I自动缩进行Ctrl + Y删除当前插入符所在的行Ctrl + D 复制当前行、或者选择的块Ctrl + Shift + J合并行Ctrl + Shift + V从最近的缓...

2018-04-02 22:41:00 78

转载 replace find join

>>> s='spam'>>> s=s.replace('m','111')>>> s'spa111'>>> where=s.find('11')>>> where3>>> s=s[:where]+'eggs'+s[(where+2):]&gt...

2018-03-31 10:47:00 86

转载 分片

>>> s='hello,world'>>> s[::-1] #分片将会从右到左进行'dlrow,olleh'>>> s[5:1:-1]',oll'>>> s[5:1]''>>>转载于:https://www.cnblogs.com/wawawawa-brie...

2018-03-30 21:58:00 89

转载 集合<class'set'>

>>> s = {1,2,3,4}>>> s&{1,3}{1, 3}>>> s|{11}{1, 2, 3, 4, 11}>>> s>{1,3}True>>> s.union({1,3}){1, 2, 3, 4}>>> s.union((11,22)){1, 2, 3,...

2018-03-30 17:55:00 534

转载 函数嵌套返回值问题

>>> def a(x): def b(y): return x+y return b>>> a(1)(4)5>>> bTraceback (most recent call last): File "<pyshell#33>", line 1, in <module> bNameError: n...

2018-03-25 21:45:00 309

转载 导入的函数使用时不加括号问题

# 复数 d 的类是complex,调用complex中的real方法,.real() 出错,.real 不带括号正常实现>>> d = 4j>>> type(d)<class 'complex'>>>> d.real()Traceback (most recent call last): File "<pys...

2018-03-25 18:48:00 190

转载 Ctrl + Shift + F7 ; F3、Shift + F3

pycharm 查找并高亮参数选中某一参数,Ctrl + Shift + F7 高亮所有该文件中所有该参数接下来, 按 F3 在所有高亮选择中向下移动一个, Shift + F3 在所有高亮选择中向上移动一个转载于:https://www.cnblogs.com/wawawawa-briefnote/p/8588317.html...

2018-03-17 11:14:00 686

转载 Dict.setdefault()

"""setdefault方法参数输入已有键,返回对应值,找不到已有键,创建新键,值为None""">>> dict4{'abc': 'abc'}>>> dict4.setdefault('aaa')>>> dict4{'abc': 'abc', 'aaa': None}>>> dict4.setd...

2018-03-17 10:41:00 98

转载 update

利用一个字典关系更新另一个字典>>> a{1: 'one'}>>> b = {'小白':'dog'}>>> a.update(b)>>> a{1: 'one', '小白': 'dog'}转载于:https://www.cnblogs.com/wawawawa-briefnote/p/8546869.html...

2018-03-11 22:54:00 70

转载 pop 与 popitem

pop给出一个键弹出值popitem弹出一个项>>> a.pop(2)'two'>>> a{1: 'one', 3: 'three', 4: 'four'}>>> a.popitem()(4, 'four')>>> a{1: 'one', 3: 'three'}popitem随机弹出,字典没有顺序 #?...

2018-03-11 22:51:00 187

转载 “copy” 与 “=“赋值

前拷贝 与 赋值>>> a = {1:'one',2:'two',3:'three'}>>> b = a.copy()>>> c = a>>> id(a)2217313747232>>> id(b)2217313747304>>> id(c)2217313747232赋...

2018-03-11 22:46:00 92

转载 list tuple dict 方法

>>> dir(list)['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '...

2018-03-11 22:41:00 79

转载 字典的方法

fromkeys(S[,v]) 方法:   创建并返回新的字典New dict with keys from S and values equal to v(v defaults to None).eg:>>>dict1 = {}>>>dict1.fromkeys((1,2,3))    #创建只有键的字典,value默认为None...

2018-03-11 22:12:00 54

转载 看不懂的缩写

src :source 源dst :destination 目的fd :file descriptor 文件描述符,形式上是一个非负整数,在Unix下,描述符是一个小整数,实则是一个索引值转载于:https://www.cnblogs.com/wawawawa-briefnote/p/8544485.html...

2018-03-11 15:57:00 86

空空如也

空空如也

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

TA关注的人

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