¹ØÓÚPythonµÄjoin£¨£©·½·¨ÎÊÌâ
´úÂëÈçÏ£º
import os
import time
source = [r'e:\python',r'e:\temp']
#print(source)
print('Ô´£º')
for spath in source:
print(spath)
target_dir = r'e:\bak'
print('\nÄ¿µÄµØ£º')
print(target_dir)
target = time.strftime('%Y%m%d%H%M%S') + '.rar'
zip_command = 'rar a %s\%s %s' % (target_dir,target,' '.join(source))
if os.system(zip_command) == 0:
print('Successful backup to',target)
else:
print('Backup FAILED')
ÎÊÌ⣺
Çë½Ìһϣ¬' '.join(source)µÄ×÷ÓÃÊǽ«ÁбísourceÖеÄÏîĿת»»Îª×Ö·û´®£¬ÄÇôΪʲôҪÔÚÕâ¸ö·½·¨Ç°¼ÓÉÏ' '.£¿ÕâÊÇʲôÓÃ;£¿ÎªÊ²Ã´²»ÄÜÖ±½ÓʹÓÃjoin(source)£¿ÎÒÊdzõѧÕߣ¬Âé·³¸÷λ²»Áߴͽ̣¬Ð»Ð»£¡
ÒòΪËûÊÇstrµÄÒ»¸ö·½·¨£¬²»ÊÇͨÓú¯Êý¡£¼´Ê¹ÓиöͨÓú¯ÊýÒ²Ó¦¸ÃÏñjoin(source, sep)¶à¸ö·Ö¸ô·û²ÎÊý²Å»áÏ൱...
¶Ôà¸, strµÄÒ»¸ö·½·¨
>>> s=''
>>> dir(s)
.......'find', 'format', 'index', 'isalnum', 'isalpha', 'isdigit', 'islower', 'isspace', 'istitle', 'isupper', 'join', ...
ÄãÏëÖ±½ÓÓÃjoinÒ²¿ÉÒԵİ¡£¬Ã»ÎÊÌ⣺
import string
string.join(["aaaa", "bbb"])
»òÕߣº
from string
Ïà¹ØÎÊ´ð£º
ÒÑÖªPython ÖУº
s = unicode("²âÊÔ", "gb2312")
s = u'\u6d4b\u8bd5'
print s
²âÊÔ
ÔÚDelphiÀïÃæÈçºÎ½«\u6d4b\u8bd5ÕâÑùµÄ»¹Ô³ÉGb2312µÄºº×ÖÄØ£¿
ÕÒµ½¸ö·½·¨
......
ÎÒÿ´ÎÉÏ´«µÄÎļþ¶Áµ½µÄÊý¾Ý¶¼²»ÕýÈ·¡£2M µÄͼƬ¶ÁµÃ10¶àK ¡£¡£ÄÄλ´óÏÀ¿ÉÒÔ°ï°ïÎÒ°¡¡£
#!D:\ProgrammerTools\python26\python.exe
#encoding=utf-8
import cgitb
import os
cgitb.enable()
import cgi,urllib ......
±ÈÈçÎÒÐèÒªÓÃpython ¶Ôwin32³ÌÐò½øÐÐÒ»¶¨µÄ¿ØÖÆ
¶ÔtextboxÊäÈëÒ»´®×Ö·û´®
°´Ä³¸öbotton
¶ÔlistboxÀïµÄµÄÄÚÈݶÁÈ¡£¬´æ³É×Ö·û´®
¸ÃÈçºÎ²Ù×÷£¿
»òÕßÄÄÀïÓÐÎĵµÀý×Ó£¿
·Ç³£¸Ðл
......
ÎÒÓÃpython¿ª·¢ÁËÒ»×éGUI½çÃ棬ÁíÍâÒ»¸öͬ־ÓÃjavaʵÏÖÁËÓ¦ÓÃÖ÷¿ò¼Ü£¬ÏÖÔÚÒª½«ÕâЩGUI½çÃ漯³Éµ½Ö÷¿ò¼ÜÀïÃæÈ¥¡£²»ÖªµÀÔÚjavaÀïÃæ¸ÃÈçºÎµ÷Ó㿼ò¶øÑÔÖ®£¬¾ÍÊÇjava´úÂëÀïÃæÈçºÎµ÷ÓÃÒ»¸öÍⲿµÄ.pyÎļþ¡£Çë¸ø³öÒ»¸ö¼òµ¥µ ......
ÓÉÓÚÊdzõѧ£¬ÔÚЩÇë½Ì´ó¼Ò¡£
Python code:
from urllib import request
import struct
class csdn:
def __init__(self):
print ('Hello,this is a init')
def getContent(self,url) ......