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

beginning python summary chapter 3 ʹÓÃ×Ö·û´®

0¡¢×Ö·û´®ÊDz»¿É±äµÄ¡£
1¡¢»ù±¾×Ö·û´®²Ù×÷£ºË÷Òý¡¢ÇÐÆ¬¡¢¸´ÖÆ¡¢³ÉÔ±¡¢³¤¶È¡¢×î´óºÍ×îС¡£
2¡¢×Ö·û´®¸ñʽ»¯£ºÓøñʽ»¯²Ù×÷·û°Ù·ÖºÅ%ʵÏÖ£¬eg:>>> format = "Hello, %s. %s enough for ya?"
                                                                          >>> values = ('world', 'Hot')  //Ôª×é
                                                                          >>> print format % values
      values ¿ÉÒÔÊǵ¥¶ÀµÄÖµ£¬±ÈÈç×Ö·û´®»òÊý×Ö£»Ò²¿ÉÒÔÊǶà¸öÖµ£¬±ÈÈçÔª×é¡£
      ÒªÔÚ¸ñʽ»¯×Ö·û´®ÀïÃæ°üÀ¨°Ù·ÖºÅ£¬ ÄãÓ¦¸ÃʹÓÃ%%¡£
      Èç¹ûÄã¸ñʽ»¯ÊµÊý£¨¸¡µãÊý£© µÄ»°£¬¿ÉÒÔʹÓÃfÕâ¸ö˵Ã÷ÀàÐÍ£¬¼ÓÉÏ×÷Ϊ¾«¶ÈµÄµãºÅ“.”£¬ºóÃæ¸úÉÏÄãÏ£Íû±£ÁôµØÐ¡ÊýλÊýµÄÊ®½øÖÆ¡£eg:>>> format = "Pi with three decimals: %.3f"
     >>> from math import pi
     >>> print format % pi
3¡¢Ä£°å×Ö·û´®£ºstringÄ£¿éÌṩÁíÍâÒ»ÖÖ¸ñʽ»¯ÖµµÄ·½·¨£ºÄ£°å×Ö·û´®¡£ËüµÄ¹¤×÷·½Ê½ÀàËÆÓںܶàUNIXShellÀïµÄ±äÁ¿Ìæ»»£¬Ê¹Óô«µÝµ½substitute·½·¨µÄfooµÄ¹Ø¼ü×Ö²ÎÊýÌæ»»$foo£º
>>> from string import Template
>>> s = Template('$x, glorious $x!')
>>> s.substitute(x='slurm')
'slurm, glorious slurm!'
Èç¹ûÌæ»


Ïà¹ØÎĵµ£º

pythonºÍdotnetµÄwebservice»¥·Ã

2007-08-22 22:46
Ò»¡¢ÓÃSOAPpy·ÃÎÊdotnet webservice
      dotnetµÄwebservice
      <WebMethod()> _
      Public Function HelloWorld() As String
          Return "H ......

Python ÓÎÏ·³õѧ

import sys, pygame, time
size = width, height = 700,700
fontColor = (0,0,255)
class walk:
'''This is a game about war.
Just like war 3.'''
def __init__(self):
'''Init the screen.
Get param and init the screen'''

#print ('this is init funnction') ......

¡¾Python¡¿ÓÃPythonʵÏÖÒ»¸ö¶íÂÞ˹·½¿éÓÎÏ·

¶íÂÞ˹·½¿éÓÎÏ·£¬Ê¹ÓÃPythonʵÏÖ£¬×ܹ²ÓÐ350+ÐдúÂ룬ʵÏÖÁ˶íÂÞ˹·½¿éÓÎÏ·µÄ»ù±¾¹¦ÄÜ£¬Í¬Ê±»á¼Ç¼Ëù»¨·Ñʱ¼ä£¬ÏûÈ¥µÄ×ÜÐÐÊý£¬ËùµÃµÄ×Ü·Ö£¬»¹°üÀ¨Ò»¸öÅÅÐаñ£¬¿ÉÒԲ鿴×î¸ß¼Ç¼¡£
ÅÅÐаñÖаüº¬Ò»ÏµÁеÄͳ¼Æ¹¦ÄÜ£¬È絥λʱ¼äÏûÈ¥µÄÐÐÊý£¬µ¥Î»Ê±¼äµÃ·ÖµÈ¡£
¸½Ô´Â룺
from Tkinter import *
from tkMessageBox import *
i ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ