ÇóÖúpython£¬map filter
map£¬filter·½·¨Ó¦¸Ã»á·µ»ØÒ»¸öÁÐ±í¡£
µ«ÊÇÔÚÎÒÕâÀËüÃÇ×ÜÊÇ·µ»Ø£º
<map object at 0x0000000002A2C978>
<filter object at 0x0000000002A2C9E8>
ÎÒÓõÄpython3.1£¬ Õâ¸öÒ²Êǰ汾µÄ±ä¶¯µ¼ÖµÄÂð£¿
def map_func(lis):
return lis + 1
li = [1,2,3,4,5]
map_l = map(map_func, li) #½«liÖÐËùÓеÄÊý¶¼+1
print (map_l)
¾ÍÊÇÕâ¸öС³ÌÐò£¬Ôõô¼Óprint£¿
¿´¿´Õâ¸ö
What's New In Python 3.0 http://blog.csdn.net/t_huanghai/archive/2008/12/04/3443782.aspx
ÀïÃæÓжÔpython3.0 map£¨£©º¯Êý½éÉÜ£¬²Î¿¼Ï £¬ÊÔÊÔ print list(map_l)
map() and filter() return iterators. If you really need a list, a quick fix is e.g. list(map(...)), but a better fix is often to use a list comprehension (especially when the original code uses lambda), or rewriting the code so it doesn¡¯t need a list at all. Particularly tricky is map() invoked for the side effects of the function; the correct transformation is to use a regular for loop (since creating a list would just be wasteful).
What's New In Python 3.0
invalid syntax
¿´À´£¬Ó¦¸ÃÕÕËü˵µÄ£¬ ÓÃfor loop
ллС¿µ
print (list£¨map_l£©)
correct format. mark it.
Ïà¹ØÎÊ´ð£º
ËÍÆ¼öÒ»±¾Ñ§Ï°PYTHONµÄÊ飬лл
¡¶python¼òÃ÷½Ì³Ì¡·£¬¡¶pythonºËÐıà³Ì¡·
×÷Ϊϵͳ¹ÜÀí·½Ãæ£¬¡¶Python UNIXºÍLinuxϵͳ¹ÜÀíÖ¸ÄÏ¡·ÊDZ¾·Ç³£²»´íµÄÊé¡£
http://club.book.csdn.net/pic3/255142.jpg
ÒýÓÃ
×÷Î ......
ÇëÎʸßÊÖ£¬pythonÀïµÄpopenÀàËÆjavaÀïµÄÄĸöÀà»òÕß·½·¨ÄØ£¿£¿ÁíÍâjython¿ª·¢java¸ÃÈçºÎʹÓÃjythonÄØ£¿£¿
1.¿ÉÄܺÍjavaÀïµÄRuntime.getRuntime().exec£¨"ϵͳÃüÁî"£©; Æô¶¯½ø³Ì
2.eclipseÏÂÔØjython ²å¼ ......
ÒÔÏ´úÂëÊÇTk×öÁËÒ»¸ö¼òµ¥µÄÃÜÂëÑéÖ¤¹¦ÄÜ£¬ÊäÈëÒ»¸ö×Ö·û´®£¬²¢ÑéÖ¤ÆäÊÇ·ñÕýÈ·£¬ÇëÏÈ¿´´úÂ룺
Python code:
from tkinter import *
root = Tk()
e = StringVar()
t = 'cashlu'
def yanzheng():
if e ......
#! c:\python26
# Filename: backup_ver1.py
import os
import time
source=[r'C:\test', r'C:\test1']
target_dir='D:\\back\\'
target=target_dir+time.strftime('%Y%m%d%H%M%S')+'.zip'
zip_command=" ......