Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

WindowsÏÂÓÃPythonÄã»á¼¸ÖÖcopyÎļþµÄ·½·¨£¿

1. os.system
Python code:
import os
import tempfile

filename1 = tempfile.mktemp (".txt")
open (filename1, "w").close ()
filename2 = filename1 + ".copy"
print filename1, "=>", filename2

#¿½Îļþ
os.system ("copy %s %s" % (filename1, filename2))

if os.path.isfile (filename2): print "Success"

dirname1 = tempfile.mktemp (".dir")
os.mkdir (dirname1)
dirname2 = dirname1 + ".copy"
print dirname1, "=>", dirname2

#¿½Ä¿Â¼
os.system ("xcopy /s %s %s" % (dirname1, dirname2))

if os.path.isdir (dirname2): print "Success"



2. shutil.copyºÍshutil.copytree
Python code:
import os
import shutil
import tempfile

filename1 = tempfile.mktemp (".txt")
open (filename1, "w").close ()
filename2 = filename1 + ".copy"
print filename1, "=>", filename2

#¿½Îļþ
shutil.copy (filename1, filename2)

if os.path.isfile (filename2): print "Success"

dirname1 = tempfile.mktemp (".dir")
os.mkdir (dirname1)
dirname2 = dirname1 + ".copy"
print dirname1, "=>", dirname2

#¿½Ä¿Â¼
shutil.copytree (dirname1, dirname2)


Ïà¹ØÎÊ´ð£º

ÇóÖú£ºpython¶ÁÈ¡mp3µÄid3±êÇ©ÐÅÏ¢ÎÊÌâ

ÎÒµÄmp3±êÇ©ÐÅÏ¢ÊÇͨ¹ýTag&Rename Èí¼þÀ´Ð޸ĵÄ
Ð޸ĵÄÐÅÏ¢ÈçÏÂ
Album Title ISRC
77 66 99

---python¶ÁÈ¡mp3µÄid3µÄ´úÂë----

from mutagen.mp3 import MP3
import mutagen.id3
......

ÈçºÎѧϰpython£¬ÈçºÎÈëÃÅ£¬ÈçºÎ¾«Í¨£¬ÇëÅ£ÈËÖ¸µãÏÂ

ÎÒÄ¿Ç°µÄÖ÷¹¥ÓïÑÔÊÇ.NET£¬ÏëѧPYTHON£¬¿´ÁËһЩ¼òµ¥µÄ¹ØÓÚpythonµÄ×ÊÁÏ£¬µ«¸Ð¾õ·Ïß²»¶Ô£¬ÏëÇëÅ£ÈËÖ¸µãÏ£º

1.ÈçºÎÈëÃÅ£¬Ä¿Ç°ÒÑÊìÁ·ÕÆÎÕC#ÓïÑÔ£¬ÆäËûÓïÑÔÊìϤµÄÒ²²»ÉÙ£¨Èçjavascript)£¬ÓкõĽ̳Ìû£¬ÓÐÏà¹ØÍ ......

¹ØÓÚÓÃPython´¦Àí´óÁ¿Êý¾ÝµÄÎÊÌâ

ÎÒÏÖÔÚÒª´¦ÀíÊý°ÙÍòÌõÊý¾Ý£¬´¦Àí¹ý³ÌÊÇͨ¹ý±È½ÏÊý¾ÝÀïÊÇ·ñÓÐÖ¸¶¨µÄ×Ö·û´®£¬ÔÙ²åÈëµ½ÁíÍâµÄ±íÖУ¬ÇëÎÊÓÃPythonÈçºÎ¸ßЧÍê³É£¿ÏÈлл¸÷λÁË¡£

½¨Ò飺±ðÖ±½Ó¸úÊý¾Ý¿â±È½Ï¡£Ì«ºÄ·ÑIO¡£
°ÑÄãÐèÒª±È½ÏµÄ×ֶδÓÊý¾Ý ......

µÚÒ»´ÎÓÃPythonд³ÌÐò£¬Ê¹ÓÃfindº¯ÊýÓöµ½Ò»¸öÎÊÌâ

//ÏÂÃæµÄ´úÂëÔËÐÐÕý³£

tomstrs=re.findall(......)
mtxx=''
for tomstr in tomstrs:
  tomstr=tomstr.strip()
  if  tomstr:
      mtxx += tomstr ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ