自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 git: 养成好习惯

每天动代码之前先 git pull 一下,以免在本地和服务器不同步的情况下写代码,导致最后 git push 时遇到麻烦。 用IDE进行git操作,有时候会更方便。

2017-12-07 23:35:04 682

原创 python: 自动去除空行

code原文档 1.txt :HelloNanjing100实现代码:file_ = "1.txt"r_file = open(file_, "r")lines = r_file.readlines()r_file.close()for idx, line in enumerate(lines): if line.split(): print(idx, line)

2017-12-07 21:37:05 10527

原创 python: 大小写转换 内建函数

内建函数 内建函数 定义 .upper() 所有字符中的小写字母转换成大写字母 .lower() 所有字符中的大写字母转换成小写字母 .capitalize() 句首字母转化为大写字母,其余小写 .title() 每个词首字母转化为大写,其余小写codestr = "Hello Nanjing !"# 所有 字符中的小写字母转换成大写字母assert str

2017-12-07 20:35:38 1212

原创 python: 获取 后缀名(扩展名) / 文件名

method使用 os.path.splitext(file)[1] 可获得以 . 开头的 文件后缀名 。codeimport osfile = "Hello.py"assert os.path.splitext(file)[1] == ".py"assert os.path.splitext(file)[1][1:] == "py"

2017-12-07 20:21:48 108815 3

原创 python: 多属性排序

多级排序实现接口即每个list中越靠前的属性优先级越大。按优先级从小到大实现多属性排序:def multi_attribute_sort(lists): first_ele = lambda s: s[0] second_ele = lambda s: s[1] last_ele = lambda s: s[-1] a = sorted(lists, key = la

2017-12-05 20:34:20 2059

转载 【目标检测】R-CNN 系列

【目标检测】R-CNN 系列

2017-12-02 17:43:29 1148 1

原创 【深度学习】CNN经典网络模型

【深度学习】CNN经典网络模型

2017-12-02 10:06:19 1427

原创 git: .gitignore文件 (忽略文件)

作用用于告诉Git需要自动忽略哪些文件。配置在仓库新建 .gitignore 文件。写入要忽略的文件名填进去,Git就会自动忽略这些文件。Note: 切记目录名后面 一定要加 反斜杠 \ ,不然会当普通文件处理。python下的gitignore文件模板gitignore/Python.gitignore:# Byte-compiled / o...

2017-12-01 09:19:55 4516

原创 【pycharm】跳转 & 回退

跳转Ctrl + 鼠标左键: 即可跳转至具体源码实现,直接查看技术细节: 回退在pycharm上方 菜单栏 中: 找到 按钮。其中, 是 回退, 是 向前 。

2017-11-29 21:34:45 11992

原创 python: 多pip版本 (pip/pip2/pip3) & 多python环境 (python/python2/python3)

本机python环境 - 配置 OS Ubuntu 14.04 Python Anaconda3 (Python3.6) + 系统自带 (Python2.7 + Python3.4)pip版本 (pip/pip2/pip3)总结不同的pip 对应 不同的python版本 。在本机中,各 pip版本 对应情况如下: pip版本 对应python版本 下载文件安放路径

2017-11-29 17:01:24 12350

原创 ubuntu: wget 指令

Syntax wget [参数列表] [目标软件、网页的网址]Args Setting在终端输入:wget -help打印结果:GNU Wget 1.15, a non-interactive network retriever.Usage: wget [OPTION]... [URL]...# wget [参数列表] [目标软件、网页的网址]Mandatory arguments to

2017-11-29 15:32:45 1408

转载 Python核心团队计划2020年停止支持Python2

原文:即将放弃Python 2.7的不止有Numpy,还有pandas和这些工具Numpy 的声明Python 核心团队计划在 2020 年停止支持 Python 2。NumPy 自 2010 年以来同时并行支持 Python 2 和 Python 3,但是由于资源有限,支持 Python 2 变成了一个日渐加重的负担;因此,我们计划最终停止支持 Python 2。现在我们进入了社区支持的 Pyth

2017-11-28 20:09:38 3114

原创 python: pyenv (python版本控制) 安装配置

sgf

2017-11-28 19:57:11 1013

原创 python: pyenv 指令备忘录

pyenv指令 command annotations pyenv install version_ 安装 version 版本的 Python pyenv uninstall version_ 删除 version 版本的 Python pyenv versions 查看 pyenv 当前可检测到的所有版本,处于激活状态的版本前以 * 标示; pyenv vers

2017-11-28 18:50:30 514

原创 numpy: np.logical_and/or/not (逻辑与/或/非)

np.logical_and (逻辑与)Syntax np.logical_and(x1, x2, *args, **kwargs)Test>>> np.logical_and(True, False)False>>> np.logical_and([True, False], [False, False])array([False, False], dtype=bool)>>> x =

2017-11-28 09:26:45 56281 2

原创 python: round 内建函数 (四舍五入)

Syntax round(number[, ndigits=0])对 number 进行 四舍五入:Args :number :可正可负 。ngigits :保留 ngigits 位 小数 。Testassert round(0.5) == 1.0assert round(-0.5) == -1.0assert round(12345.678, -5) == 0.0assert ro

2017-11-28 08:50:00 4964

原创 git: 简洁高效 的 双分支式 git flow (master + dev)

git flow 总结对比Git 作为一个源码管理系统,不可避免涉及到多人协作。使用 git branch (git 分支)进行版本控制,可以让大家有效地合作,使得项目井井有条地发展下去。网络上关于 使用 git branch (git 分支)进行版本控制 的教程汗牛充栋。它们提出了形形色色,功能各异的 分支方案: 分支名 时效性 分支功能 master 长期分支 管理对外发布

2017-11-27 16:26:43 1901

原创 AttributeError: 'module' object has no attribute 'fullmatch'.

报错跑代码的时候遇到了 AttributeError :AttributeError: 'module' object has no attribute 'fullmatch'.经过查找,发现出错的原因是 re库 中的 fullmatch函数 是 在py3.4之后才新添加的 。解决方案自己写一个接口,然后调用该接口即可。一般会把自己新写的接口放在 utils.py 文件里。在该文件中加上以下代码段:

2017-11-27 15:52:04 6154

原创 numpy: np.argsort

Syntax argsort(a, axis=-1, kind=’quicksort’, order=None)返回 数组值 从小到大 的 索引值 。实验代码# coding: utf-8import numpy as np# 返回 数组值 从小到大 的 索引值x = np.array([[20, 10, 30, 40], [100, 200, 300, 40

2017-11-25 11:12:44 525

原创 numpy: np.ndarray.flatten

Syntax ndarray.flatten(order=’C’)将numpy数组的返回成 一个维度 。Args: 顺序:{‘C’,’F’,’A’,’K’},可选。 “C” 意思是以行大(C形)的顺序变平。 “F” 表示按列主要(Fortran风格)顺序变平。 如果a是Fortran在内存中连续的,那么”A” 意味着以列主要顺序变平,否则按行排序。 “K” 意思是按照元素在内存中

2017-11-25 11:01:22 1304

原创 numpy: np.where

Syntax numpy.where(condition[, x, y])返回 符合某一条件 的 下标 。Note : 不接受 list 型的参数,只接受 `ndarray 型输入。用法单目运算import numpy as nparray_1 = np.array([1, 0, 1, 5, 5, 1])array_2 = np.array([[1, 0, 1],

2017-11-23 20:14:01 1450

原创 python: TODO 助记符

概述TODO 在 python 中作为一种 助记符 (Mnemonics),用来解释 将要做什么 。Syntax TODO: Informal tasks/features that are pending completion.例如:可以在 TODO 里注上自己的名字:# TODO(jn@gmail.com): Use a "*" here for string repetition.#

2017-11-23 19:37:52 7258

原创 leetcode: 100. Same Tree

QGiven two binary trees, write a function to check if they are the same or not.Two binary trees are considered the same if they are structurally identical and the nodes have the same value.Example 1:In

2017-11-23 09:02:15 525

原创 leetcode: 99. Recover Binary Search Tree

QTwo elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note: A solution using O(n) space is pretty straight forward. Could you devise a cons

2017-11-23 09:01:40 589

原创 leetcode: 98. Validate Binary Search Tree

QGiven a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only nodes with keys less than the node’s key. The righ

2017-11-23 09:00:14 474

原创 leetcode: 97. Interleaving String

QGiven s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2.For example, Given: s1 = “aabcc”, s2 = “dbbca”,When s3 = “aadbbcbcac”, return true. When s3 = “aadbbbaccc”, return fals

2017-11-22 10:25:05 687

原创 leetcode: 96. Unique Binary Search Trees

QGiven n, how many structurally unique BST’s (binary search trees) that store values 1…n?For example, Given n = 3, there are a total of 5 unique BST’s. 1 3 3 2 1 \ /

2017-11-22 10:24:24 433

原创 leetcode: 95. Unique Binary Search Trees II [✗]

QGiven an integer n, generate all structurally unique BST’s (binary search trees) that store values 1…n.For example, Given n = 3, your program should return all 5 unique BST’s shown below. 1

2017-11-22 10:23:49 464

原创 leetcode: 94. Binary Tree Inorder Traversal

QGiven a binary tree, return the inorder traversal of its nodes’ values.For example: Given binary tree [1,null,2,3], 1 \ 2 / 3return [1,3,2].Note: Recursive solution is trivial, cou

2017-11-22 10:23:17 422

原创 leetcode: 93. Restore IP Addresses

QGiven a string containing only digits, restore it by returning all possible valid IP address combinations.For example: Given “25525511135”,return [“255.255.11.135”, “255.255.111.35”]. (Order does not

2017-11-22 10:22:46 371

原创 leetcode: 92. Reverse Linked List II

QReverse a linked list from position m to n. Do it in-place and in one-pass.For example: Given 1->2->3->4->5->NULL, m = 2 and n = 4,return 1->4->3->2->5->NULL.Note: Given m, n satisfy the following c

2017-11-22 10:22:19 370

原创 leetcode: 91. Decode Ways

QA message containing letters from A-Z is being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message containing digits, determine the total number of

2017-11-22 10:21:50 500

原创 leetcode: 90. Subsets II

QGiven a collection of integers that might contain duplicates, nums, return all possible subsets (the power set).Note: The solution set must not contain duplicate subsets.For example, If nums = [1,2,2

2017-11-22 10:21:20 439

原创 leetcode: 89. Gray Code

QThe gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n representing the total number of bits in the code, print the sequence of gray

2017-11-22 10:20:50 464

原创 python: center、ljust、rjust 函数

Syntaxljust str. ljust(width[, fillchar])rjust str. rjust(width[, fillchar])center str. center(width[, fillchar])Argswidth: 指定字符串长度。fillchar: 填充字符,默认为空格。实验代码str_ = 'Nanjing'assert str_.cen

2017-11-22 09:58:54 4021

原创 leetcode: 88. Merge Sorted Array

QGiven two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note: You may assume that nums1 has enough space (size that is greater or equal to m + n) to hold additiona

2017-11-21 10:12:51 450

原创 leetcode: 87. Scramble String

QGiven a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representation of s1 = “great”: great / \ gr eat

2017-11-21 10:12:16 446

原创 leetcode: 86. Partition List

QGiven a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.You should preserve the original relative order of the nodes in each of the

2017-11-21 10:11:51 393

原创 leetcode: 85. Maximal Rectangle

Problem# Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing only 1's and return its area.## For example, given the following matrix:## 1 0 1 0 0# 1 0 1 1 1# 1

2017-11-21 10:11:19 464

原创 leetcode: 84. Largest Rectangle in Histogram

Problem# Given n non-negative integers representing the histogram's bar height where the width of each bar is 1,# find the area of largest rectangle in the histogram.# Above is a histogram where width

2017-11-21 10:10:48 422

Pycharm简洁高效的主题设置

这是我在日常使用Pycharm IDE过程中,根据个人喜好所逐渐形成的一整套主题设置。主要亮点:简洁高效。欢迎下载。

2018-01-01

空空如也

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

TA关注的人

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