yipeiwu_com6年前
Python中list的倒序索引和切片是非常常见和方便的操作,但由于是倒序,有时候也不太好理解或者容易搞混。 >>> nums = [0, 1, 2, 3, 4,...
yipeiwu_com6年前
代码1: #!/usr/bin/python import numpy as np arr1 = np.arange(10) print(arr1) slice_data...
yipeiwu_com6年前
成绩分数等级为: 100-90 A 90-80 B 80-70 C 70-60 D 60以下 F 实现判断分数等级是一个很简单的数学问题,只要你输入的这个数字介于两...
yipeiwu_com6年前
简单的小练习,注意考虑全可能就行,下面是实现: #!usr/bin/env python #encoding:utf-8 ''' __Author__:沂水寒城 功能:̶...
yipeiwu_com6年前
如下所示: ljust(len,str)字符向左对齐,用str补齐长度 rjust(len,str)字符向右对齐,用str补齐长度 rjust(len,str)字符中间对齐,用s...
yipeiwu_com6年前
Pandas Shift函数基础 在使用Pandas的过程中,有时会遇到shift函数,今天就一起来彻底学习下。先来看看帮助文档是怎么说的: >>> import...
yipeiwu_com6年前
使用 Python 进行数据处理的时候,常常会遇到判断一个数是否在一个区间内的操作。我们可以使用 if else 进行判断,但是,既然使用了 Python,那我们当然是想找一下有没有现成...
yipeiwu_com6年前
情况一:列表中的数字是连续数字(从小到大) from itertools import groupby lst = [1, 2, 3, 5, 6, 7, 8, 11, 12, 13...
yipeiwu_com6年前
生成txt文件: mesg = "hello world" with open("test.txt", "w") as f: f.write("{}".format(mesg))...
yipeiwu_com6年前
如下所示: date 20170307 20170308 iphone4 2...