![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python
2tong杂货铺
哈尔滨工业大学 计算机科学与技术 硕士
展开
-
from __future__ import print_function 用途?
最近阅读代码的时候,常见到如下所示的代码: from __future__ import print_function import torch from __future__ import print_function的作用主要是在python2.X中引入python3.X的print特性。 from __future__ import print_function print("hello, 2tong.") ...原创 2020-08-01 20:14:22 · 228 阅读 · 0 评论 -
Jupyter安装
1.安装方式 pip install jupyter 可能遇到的问题:目标计算机积极拒绝,大概是这样的报错: 解决方式: 关掉代理服务器设置,再次尝试,成功解决。 2.使用方式 本地启用方式: jupyter notebook ...原创 2019-10-17 17:15:16 · 185 阅读 · 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 · 203 阅读 · 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 · 127 阅读 · 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: 6 E...原创 2019-04-08 11:18:24 · 176 阅读 · 0 评论 -
Climbing Stairs问题
难度级别:Easy 1.题目描述 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 · 135 阅读 · 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 · 342 阅读 · 0 评论