-
对异常函数进行重试数次
所属栏目:[Python] 日期:2020-12-17 热度:161
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 def retry(times=1,exceptions=None): exceptions = exceptions if exceptions is not None else Exception def wrapper(func): def wrapper(*args,**[详细]
-
分形图
所属栏目:[Python] 日期:2020-12-17 热度:138
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 #!/usr/bin/env python3""" turtle-example-suite: tdemo_bytedesign.pyAn example adapted from the example-suiteof PythonCard's turtle graphics.[详细]
-
北京地铁月支出简易计算器
所属栏目:[Python] 日期:2020-12-17 热度:180
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 #!/usr/bin/env python# -*- coding: utf-8 -*-from __future__ import divisionimport math# 0-100 *1# 100 =150 *0.8# 150 *0.5def caclMonthFee(pe[详细]
-
小白求教
所属栏目:[Python] 日期:2020-12-17 热度:158
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 d={'A':90,'B':80,'C':70}print d{'A': 90,'C': 70,'B': 80}[Finished in 0.0s] 以上是编程之家(jb51.cc)为你收集整理的全部代码内容,希望文章能够帮[详细]
-
获取城市天气的Python脚本
所属栏目:[Python] 日期:2020-12-17 热度:128
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 原文? http://xianglong.me/article/get-city-weather-using-python-script/ #!/usr/bin/env python# -*- coding: utf-8 -*-# import requestsimport[详细]
-
基本字符串压缩
所属栏目:[Python] 日期:2020-12-17 热度:166
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 class Zipper: def zipString(self,iniString): nlen = len(iniString) rest =[] i = 0 endflag = 0 while i (nlen-1): for j in range(i+1,nlen): if[详细]
-
按日期对照片进行分类整理
所属栏目:[Python] 日期:2020-12-17 热度:156
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 # -*- coding:utf-8 -*-__author__ = 'Barry'from PIL import Imagefrom PIL.ExifTags import TAGSfrom datetime import datetimefrom hashlib import[详细]
-
下载png图标素材
所属栏目:[Python] 日期:2020-12-17 热度:100
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 ?import reimport osimport urllib.requesthome = "http://sc.chinaz.com"def downIco(tit,url): page = urllib.request.urlopen(url).read() page =[详细]
-
python字典取出文件倒数第N行.py
所属栏目:[Python] 日期:2020-12-17 热度:119
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 """python字典取出文件倒数第N行.pyhttp://www.bathome.net/thread-38591-1-1.html依山居 7:44 2015/12/14本质还是对数组进行操作思路是生成行号,倒[详细]
-
基础汇编->机器语言翻译器
所属栏目:[Python] 日期:2020-12-17 热度:154
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 #! -*- coding:utf8 -*-# Author: L******# StudentNumber: 514*******# Class: F14*****# Time: 2014/10/25 21:30:23# Prog: Simple translator of a[详细]
-
非常简洁的快速排序法(python)
所属栏目:[Python] 日期:2020-12-17 热度:179
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 def quickSort (arr): """ Quicksort a list :type arr: list :param arr: List to sort :returns: list -- Sorted list """ if not arr: return [] p[详细]
-
天涯帖子解放F5(只看楼主)
所属栏目:[Python] 日期:2020-12-17 热度:135
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 '''天涯帖子直播20150426Python3.4.3'''import re,time,osimport requestsfrom bs4 import *header={'Accept':'text/html,application/xhtml+xml,appl[详细]
-
删除空文件夹
所属栏目:[Python] 日期:2020-12-17 热度:130
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 import osfor root,dirs,files in os.walk(top,topdown=False):for name in dirs:try:os.rmdir(os.path.join(root,name))except:pass 以上是编程之家([详细]
-
python计算肇事车牌照号
所属栏目:[Python] 日期:2020-12-17 热度:110
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 """python计算肇事车牌照号http://www.bathome.net/thread-16242-1-1.html依山居 4:28 2015/11/25"""#方法1 思路是先生成所有的aabb和aaaa的数字组合.[详细]
-
Excel文件读写类
所属栏目:[Python] 日期:2020-12-17 热度:77
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 以上是编程之家(jb51.cc)为你收集整理的全部代码内容,希望文章能够帮你解决所遇到的程序开发问题。 如果觉得编程之家网站内容还不错,欢迎将编程之家[详细]
-
文件拷贝
所属栏目:[Python] 日期:2020-12-17 热度:189
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 #coding:cp936'''Created on 2011-6-21@author: tangly文件拷贝'''import osdef MyCopyFile(srcfile,destfile):if not os.path.exists(srcfile):print[详细]
-
生成随机MAC地址
所属栏目:[Python] 日期:2020-12-17 热度:145
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 import randomMaclist = []for i in range(1,7): RANDSTR = "".join(random.sample("0123456789abcdef",2)) Maclist.append(RANDSTR)RANDMAC = ":".jo[详细]
-
python 猜位置练习
所属栏目:[Python] 日期:2020-12-17 热度:57
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 from random import randintboard = []for x in range(5): board.append(["O"] * 5)def print_board(board): for row in board: print " ".join(row)p[详细]
-
利用正则表达式匹配并截取指定子串并去重
所属栏目:[Python] 日期:2020-12-17 热度:165
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 import repattern=re.compile(r'| (d+) | (d+) |')numset=set()all='''| 29266795 | 533 || 29370116 | 533 || 29467495 | 533 || 29500404 | 53[详细]
-
五子棋
所属栏目:[Python] 日期:2020-12-17 热度:130
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 from graphics import *from math import *def gobangwin(): win=GraphWin("this is a gobang game",400,400) #??×÷21x21μ????ì win.setBackgroun[详细]
-
翻页抓取
所属栏目:[Python] 日期:2020-12-17 热度:186
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 #!/usr/bin/env python#coding:utf-8import urllib2import reimport os def getHtml(url): #获取html源码headers={"User-Agent":"Mozilla/4.0 (compat[详细]
-
阶乘
所属栏目:[Python] 日期:2020-12-17 热度:156
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 def fact(x): return x 1 and x * fact(x - 1) or 1print fact(6) 以上是编程之家(jb51.cc)为你收集整理的全部代码内容,希望文章能够帮你解决所遇到[详细]
-
糗事百科python版
所属栏目:[Python] 日期:2020-12-17 热度:50
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 以上是编程之家(jb51.cc)为你收集整理的全部代码内容,希望文章能够帮你解决所遇到的程序开发问题。 如果觉得编程之家网站内容还不错,欢迎将编程之家[详细]
-
一句正则表达式删除所有C语言注释
所属栏目:[Python] 日期:2020-12-17 热度:163
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 import recode_file = open('test.c','r')code_content = code_file.read()code_content_temp = re.sub(r'((?=n)|^)[ t]*/*.*?*/n?|/*.*?*[详细]
-
Python3 计算出同花的概率
所属栏目:[Python] 日期:2020-12-17 热度:115
今天PHP站长网 52php.cn把收集自互联网的代码分享给大家,仅供参考。 每次抽取后都重新洗牌。计算10000次随机抽取可得到同花的几率。我做的比较复杂,分别累计了四种花色分别出现了几次。 import randomlist=["2","3","4"[详细]
