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

python Á·ÊÖ


¿ÉÒÔ²¥·Å´ó²¿·ÖµÄÒôÊÓƵ.
demo download:  http://www.sandy1219.com/python/media.rar
playMP3.py
# -*- coding: utf-8 -*-
import wx;
import wx.media;
import os;
import SPrint;
import mediaStateBar;
import mediaList;
import SaveLog;
import MediaItem;
woldcart = "media files|*.*|avi|*.avi|rmvb|*.rmvb|rm|*.rm|wma|*.wma|mp3|*.mp3";
class MediaFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self,None,wx.NewId(),u"ýÌå²¥·ÅÆ÷",pos=wx.DefaultPosition,size=(500,500));
self.media = '';
try:
self.media = wx.media.MediaCtrl(self,style=wx.SIMPLE_BORDER,
#szBackend=wx.media.MEDIABACKEND_DIRECTSHOW
#szBackend=wx.media.MEDIABACKEND_QUICKTIME
#szBackend=wx.media.MEDIABACKEND_WMP10
);
self.media.Bind(wx.media.EVT_MEDIA_LOADED,self.mediaLoaded);
self.media.Bind(wx.media.EVT_MEDIA_STATECHANGED,self.mediaStateChange)
except NotImplementedError:
self.Destroy()
raise;
self.listView = '';
self.item = MediaItem.MediaItem();
self.sb = mediaStateBar.MediaStateBar(self);
self.SetStatusBar(self.sb);
self.log = SaveLog.SaveLog();
#self.log.test();
self.menu = wx.Menu()
self.openMenu = self.menu.Append(wx.NewId(),u"´ò¿ªÎļþ");
self.Bind(wx.EVT_MENU,self._openFile,self.openMenu);
self.quitMenu = self.menu.Append(wx.NewId(),u"Í˳ö");
self.Bind(wx.EVT_MENU,self.quit,self.quitMenu);
self.viewMenu = wx.Menu();
self.listMenu = self.viewMenu.Append(wx.NewId(),u"´ò¿ª²¥·ÅÁбí");
self.Bind(wx.EVT_MENU,self.openList,self.listMenu);
self.loadListMenu = self.viewMenu.Append(wx.NewId(),u"¼ÓÔز¥·ÅÁбí");


Ïà¹ØÎĵµ£º

PythonÈëÃŵÄ36¸öÀý×Ó——17 Return

# 017
def lifeIsAMirror():
string = raw_input()
if string == 'I love you!':
return 'I love you, too!'
elif string == 'Fuck you!':
return ''
else:
return
# end of def
string = lifeIsAMirror()
if len(string) == 0:
print 'You have nothing.'
else: ......

Python:FriendFeedµÄTornado Web Server

´úÂëºÜ¼òµ¥£¬²»µ½5kÐС£µ«ÊÇ˼·ͦºÃµÄ£¬¸Ä³Énon-blockingÁËÖ®ºóЧÂʾÍÊÇÄÜÌá¸ß²»ÉÙ£¬ÌرðÊÇ¿¼Âǵ½ÏÖ´úµÄweb app¶¼ÐèÒªºÍÆäËûµÄ
HTTP·þÎñÆ÷ͨÐÅ£¬blockingµÄ´ú¼ÛÌ«´óÁË¡£ Tornado is an open source version of the scalable, non-blocking web server and tools that power FriendFeed. The FriendFeed application ......

PythonÄ£¿éѧϰ

¡¡¡¡ÓÐʱºò£¬Òª°ÑÄÚ´æÖеÄÒ»¸ö¶ÔÏó³Ö¾Ã»¯±£´æµ½´ÅÅÌÉÏ£¬»òÕßÐòÁл¯³É¶þ½øÖÆÁ÷ͨ¹ýÍøÂç·¢Ë͵½Ô¶³ÌÖ÷»úÉÏ¡£PythonÖÐÓкܶàÄ£¿éÌṩÁËÐòÁл¯Óë·´ÐòÁл¯µÄ¹¦ÄÜ£¬È磺marshal, pickle, cPickleµÈµÈ¡£½ñÌì¾Í½²½²marshalÄ£¿é¡£
¡¡¡¡×¢Ò⣺
marshal²¢²»ÊÇÒ»¸öͨÓõÄÄ£¿é£¬ÔÚijЩʱºòËüÊÇÒ»¸ö²»±»ÍƼöʹÓõÄÄ£¿é£¬ÒòΪʹÓÃmarshalÐ ......

PythonÈëÃŵÄ36¸öÀý×Ó Ö® 19

Ô´´úÂëÏÂÔØ£ºÏÂÔصØÖ·ÔÚÕâÀï
# 022
listNum1 = [1, 3]
listNum2 = [2, 4]
listStr1 = ['a', 'c']
listStr2 = ['b', 'd']
# ÁбíµÄºÏ²¢
list1 = listNum1 + listStr1
for ele in list1:
print ele
print '\n'
# ÅжÏÁбíÖÐÊÇ·ñ°üº¬Ä³ÔªËØ
print 'b' in list1
print 1 in list1
# ɾ³ýij¸öÔªËØ
for ele in ......

PythonÈëÃŵÄ36¸öÀý×Ó Ö® 33

Ô´´úÂëÏÂÔØ£ºÏÂÔصØÖ·ÔÚÕâÀï
# 037
fileName = ''
while 1:
fileName = raw_input("Input a file name:")
if fileName == 'q':
break
try:
f = file(fileName, 'r')
print 'Opened a file.'
except:
print 'There is no file named', fileName
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ