Ò»¸öPythonС½Å±¾ÔËÐг¬Âý
ÎÒÓÃPythonдÁËÒ»¸öС½Å±¾£¬×÷ÓÃÊÇͳ¼ÆÎÒe:\downloadĿ¼ÏÂÎļþ¶¼°üº¬ÁËÄÄЩÀ©Õ¹Ãû£¬²¢´òÓ¡³öÀ´£¬µ«ÊDz»ÖªµÀΪʲô£¬Õâ¸ö½Å±¾ËäÈ»¿ÉÒÔÕý³£µÄÔËÐУ¬µ«ÊÇÔËÐеķdz£·Ç³£Âý£¬Æ½¾ùÿһ´ÎÔËÐеÄʱ¼ä¶¼³¬¹ýÁË1·ÖÖÓ²ÅÓнá¹û£¬Çë½Ìһϸ÷λÕâÊÇΪʲô£¿ÊDz»ÊÇÎҵijÌÐòÄÄÀïÉè¼ÆµÄ²»ºÏÀíµ¼Öµģ¿ ±¸×¢£º ÎÒµÄe:\downloadĿ¼Ï£¬×ܹ²ÓÐ27103¸öÎļþ£¬1010¸öÎļþ¼Ð£¬×ܹ²´óС70G×óÓÒ¡£ ´úÂëÈçÏ£º Python code: import os import os.path import re path = 'e:/download/' kzm = [] newKzm = [] for root,dirs,files in os.walk(path): for file in files: f = (os.path.join(root,file)) if '.' in f and re.search('\w{4}$',f): var = f[-4:] kzm.append(var) elif '.' in f and re.search('\w{3}$',f): var = f[-3:] kzm.append(var) elif '.' in f and re.search('\w{2}$',f): var = f[-2:] kzm.append(var) for i in kzm: if kzm.count(i) >= 2 and newKzm.count(i) ==0: newKzm.append(i) elif kzm.count(i) == 1: newKzm.append(i) print(newKzm)
ÒýÓà ÊÔÊÔpythonÌṩµÄÏֳɷ½·¨... Python codeimport os path='e:/download/' kzm= set()for root,dirs,filesin os.walk(path):for filein files: ext= os.path.splitext(file)[1] kzm.add(ext)print kzm ·Ç³£¸Ðл£¡È·Êµ±È
Ïà¹ØÎÊ´ð£º
ÎÒÿ´ÎÉÏ´«µÄÎļþ¶Áµ½µÄÊý¾Ý¶¼²»ÕýÈ·¡£2M µÄͼƬ¶ÁµÃ10¶àK ¡£¡£ÄÄλ´óÏÀ¿ÉÒÔ°ï°ïÎÒ°¡¡£ #!D:\ProgrammerTools\python26\python.exe #encoding=utf-8 import cgitb import os cgitb.enable() import cgi,urllib ......
ÔÚÎı¾ÎļþÖÐÆ¥ÅäÏî°üº¬ÖÐÎÄ ÈçÄÚÈÝΪ£ºgamename=ÖÐÎÄ key=ÌìÏ Îı¾ÎļþµÄ±àÂëµÄÎļþΪutf-8 python´úÂëÈçÏ£º # -*- coding:UTF-8 -*- contents=open(from_pa ......
ÇëÎʸßÊÖ£¬pythonÀïµÄpopenÀàËÆjavaÀïµÄÄĸöÀà»òÕß·½·¨ÄØ£¿£¿ÁíÍâjython¿ª·¢java¸ÃÈçºÎʹÓÃjythonÄØ£¿£¿ 1.¿ÉÄܺÍjavaÀïµÄRuntime.getRuntime().exec£¨"ϵͳÃüÁî"£©; Æô¶¯½ø³Ì 2.eclipseÏÂÔØjython ²å¼ ......
ÎÒÊÇÔÚwindowsƽ̨Ï£¬ÓÃpython2.6 ±àдÁË£¬Ð»Ð»´ó¼ÒÁË ÓÐpython2exeÕâ¸ö¹¤¾ß£¬ÄãÉÏÍøËÑһϠpy2exe°ü£¬ÍøÉÏÓÐϵġ£ »¹ÓÐÒ»¸öPyrex¿ÉÒÔתÒëΪ´¿C£¬ÔÙÖ±½Ó±àÒë¡£---ÎÒû×Ðϸѧϰ¹ý ÎÒÊÇÓÃpyinstaller× ......