Python
2tong杂货铺
哈尔滨工业大学 计算机科学与技术 硕士
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
from __future__ import print_function 用途?
最近阅读代码的时候,常见到如下所示的代码:from __future__ import print_functionimport torchfrom __future__ import print_function的作用主要是在python2.X中引入python3.X的print特性。from __future__ import print_functionprint("hello, 2tong.")...原创 2020-08-01 20:14:22 · 289 阅读 · 0 评论 -
Jupyter安装
1.安装方式pip install jupyter可能遇到的问题:目标计算机积极拒绝,大概是这样的报错:解决方式:关掉代理服务器设置,再次尝试,成功解决。2.使用方式本地启用方式:jupyter notebook...原创 2019-10-17 17:15:16 · 323 阅读 · 0 评论 -
Python 2.7 --- 小手册
不定期整理,仅用于学习和记录,如果有错误,请及时帮忙订正,谢谢~1.Filter函数1.1 使用方式##语法filter(function, iterable)##Python 2.7返回的是一个list,Python 3返回的是一个迭代器##举例 def greater_than_five(n): return n > 5 newlist = filte...原创 2019-10-12 17:39:33 · 367 阅读 · 0 评论 -
Python回顾整理与学习--------range和xrange的异同
Python 2中:1.range([start,] stop[, step])根据指定的初始值start,stop和步长step返回一个list。>>>range(0,3,1)[0,1,2]>>>range(0,4,2)[0,2]2.xrange([start,] stop[, step])根据指定的初始值start,stop和...原创 2019-04-08 10:09:19 · 182 阅读 · 0 评论 -
Maximum Subarray问题
1.问题描述Given an integer array nums, find the contiguous subarray(containing at least one number) which has the largest sum and return its sum.Example:Input: [-2,1,-3,4,-1,2,1,-5,4],Output: 6E...原创 2019-04-08 11:18:24 · 251 阅读 · 0 评论 -
Climbing Stairs问题
难度级别:Easy1.题目描述You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?Note: Given n...原创 2019-04-08 14:08:14 · 217 阅读 · 0 评论 -
Whoosh初次使用
1.Python代码1.1 构建索引def build_index(file_path): start_time = time.clock() schema = Schema(title=TEXT(stored=True), path=ID(stored=False), content=TEXT(stored=True)) ix = cr...原创 2019-04-12 13:39:54 · 418 阅读 · 0 评论
分享