LeetCode 406. Queue Reconstruction by Height 解题报告题目描述Suppose you have a random list of people standing in a queue. Each person is described by a pair of integers (h, k), where h is the height of the person and k is the number of people in front of th…
1.列表的切片. 1.对list进行切片.'''name=["wangshuai","wangchuan","wangjingliang","wangshuai"]#想取出前三个元素,应该怎么做?#(1)笨办法'''print(name[0],name[1],name[2])'''#(2)用循环实现.'''for i in range(len(name)): if(i<3): print(name[i]) else: b…
一般我们进行数据统计的时候要进行数据摸查,可能是摸查整体的分布情况啊.平均值,标准差,总数,各分段的人数啊.这时候用excel或者数据库统计都不方便. 我要统计的一个文件,太大了,还得分成15个文件,结果导一个进mysql都要导很久.再mysql进行编程,执行更久,很费事. 但是用python直接统计就很方便啦. @author: pc """ import matplotlib as mpb import pandas as pd import pylab as pl im…
一.线程 线程为程序中执行任务的最小单元,由Threading模块提供了相关操作,线程适合于IO操作密集的情况下使用 #!/usr/bin/env python # -*- coding:utf-8 -*- import threading import time def show(arg): time.sleep(1) print 'thread'+str(arg) for i in range(10): t = threading.Thread(target=show, args=(i,))…
首先,强烈推荐<<简明 Python 教程>> Swaroop, C. H. 著 沈洁元 译 其实,这本书里已经把python的最基本的用法,编码等等介绍的很好,这里把我用到的进行一下总结. 1. 字符串 连接 字符串数组 转义字符 Excellent Reference Link :http://www.w3cschool.cc/python/python-strings.html 字符串 ● 使用单引号(')你可以用单引号指示字符串,就如同'Quote me on this'这…