码迷,mamicode.com
首页 >  
搜索关键字:def    ( 28626个结果
pygame之精灵碰撞检测
1、创建精灵和精灵组并检测碰撞 import random import pygame from pygame.locals import * class Player(pygame.sprite.Sprite): # 继承pygame.sprite.Sprite精灵对象 def __init__( ...
分类:其他好文   时间:2021-06-10 18:41:25    阅读次数:0
2、python3+openpyxl操作excel(xlsx)
python3+openpyxl操作excel(xlsx)学习分享,如有问题请大佬指教! 代码如下: 1 import openpyxl 2 3 class DoExcel: 4 """操作excel类:xlsx格式文件 5 file:文件名及路径 6 sheet:表单名""" 7 def __in ...
分类:编程语言   时间:2021-06-10 18:24:32    阅读次数:0
计算几何三角形模板(持续更新)
三角形模板 const int N = 1e5 + 50; const ld PI = acos(-1.0); const ld eps=1e-8; int sgn(ld x) { if(fabs(x)<eps)return 0; return x<0?-1:1; } struct Point { ...
分类:其他好文   时间:2021-06-10 17:53:30    阅读次数:0
python一行代码求阶乘或求和(reduce函数的使用)
对1~1000求阶乘 上面的x y可以自由换成其他表达式,如 x+y、x y、x 2+y、2 x+5 y 等等 range(1,1001)表示生成1到1000的连续整数列表(List)。 reduce(functionA,iterableB),functionA为需要两个变量的函数,并返回一个值。i ...
分类:编程语言   时间:2021-06-10 17:52:09    阅读次数:0
leetcode-python-FizzBuzz
?这是啥算法题。。 逐个判断写个循环即可 class Solution: def fizzBuzz(self, n: int) -> List[str]: result = [] for i in range(1,n+1): if i % 3 == 0 and i % 5 == 0 : result ...
分类:编程语言   时间:2021-06-10 17:39:18    阅读次数:0
函数基础
函数基础 三问: # 什么是函数 函数就是封装了一个功能 # 为什么用 实现代码的整,增加代码可读性,减少代码冗余,增强可扩展性 # 怎么用 先定义在调用 函数定义 def 函数名(参数1,参数2 ...): '''文档描述''' 函数体 return 函数调用 函数名() ''' 定义函数只检测语 ...
分类:其他好文   时间:2021-06-10 17:37:40    阅读次数:0
使用pandas合并结构相同的csv文件
#encoding=utf-8 import pandas as pd import os import csv def concat_csv(filename,dirpath): with open(filename,'w') as f: cw=csv.writer(f) cw.writerow( ...
分类:其他好文   时间:2021-06-09 15:30:20    阅读次数:0
PyQt5实战——《点击事件》
演示 代码 from PyQt5.QtWidgets import * import sys class pushButton(QWidget): def __init__(self): super(pushButton,self).__init__() # 对方法进行调用 self.initUI( ...
分类:其他好文   时间:2021-06-09 15:30:07    阅读次数:0
多进程的调用(multiprocessing.Process)
import multiprocessing, time, os# def pro(name):# print('hello', name, time.ctime())## if __name__ == '__main__':# l = []# for t in range(4):# t = mul ...
分类:系统相关   时间:2021-06-08 23:20:39    阅读次数:0
turtle应用
import turtle from random import * from math import * turtle.seth(90) def tree(n,l): turtle.down() turtle.pencolor('#410200') turtle.pensize(n*3) turt ...
分类:其他好文   时间:2021-06-08 23:16:21    阅读次数:0
28626条   上一页 1 ... 10 11 12 13 14 ... 2863 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!