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

python list for Ñ­»·ÎÊÌâ

Python code:

p=[1,2,3,4,5,6]
while True:
for i in p:
if i==4:
p=[]
f=[9,8,7]
p.extend(f)
break
print i£¬',',
p.remove(i)

if not p:
break
#expect output is:1,2,3,9,8,7,


¸ßÊÖ°ïÎÒ¿´¿´£¬ÎªÊ²Ã´Îҵò»µ½ÎÒÏëÒªµÄ½á¹ûÄØ,ÓÐʲô·½·¨¿ÉÒԵõ½ÎÒÏëÒªµÄ½á¹ûÂð

for i in p:Ó¦¸ÃÒª¼«Á¦±ÜÃâÈ¥¸Ä±äp¡£whileÀïËæ±ãÆð¸öÕûÊýµ±listϱêÀ´·ÃÎÊÔªËØ£¬È»ºóÑ­»·µÝÔöÕâ¸öÕûÊý...

for i in p:
  ---> iÊÇÁбípµÄÔªËØ
p.remove(i)
  --->Õâ¸öiÊÇÁбípµÄË÷Òý

ÁíÍ⣺
p=[1,2,3,4,5,6]
f=[9,8,7]
p[p.index(4):]=f

¾Í¿ÉÒÔʵÏÖÄãÒªµÄ



ÒýÓÃ

Ò»¡¢½ûÖ¹ÔÚfor±éÀúµÄʱºòÐ޸ı»±éÀúµÄ¶ÔÏó¡£
¶þ¡¢¾¡Á¿ÉÙдforÑ­»·¡£
Èý¡¢Ã»¿´Ã÷°×ÄãÏëÒª×öʲôʵ¼ÊµÄÊÂÇé¡£ÄãÉÔ΢½âÊÍϰɡ£Òª¿´¶®Ò»¶Î´íÎóµÄ´úÂë±¾À´Ïë×öʲôÊÂÇéÊDZȽÏÄѵġ£


ÎÒµÄÒâ˼Êǽ«ÁбíÖÐ4֮ǰµÄÔªËØ´òÓ¡³öÀ´£¬4Ö®ºóµÄ²»´òÓ¡£¬µ«Ã¿´ÎÓö¼û4µÄʱºò»áÓÐÒ»¸öеÄlistÒª´òÓ¡£¬Õâ¸ölistÖÐÒ²ÓпÉÄÜÓÐ4£¬´¦ÀíºÍÇ°ÃælistÒ»Ñù

µ±È»ÎÒʵ¼Ê×÷µÄ¶«Î÷²»ÊÇÕâ¸ö£¬ÕâÖ»ÊÇÎÒ¼ò»¯Ö®ºóдµÄ²âÊÔ´úÂ룬µ«Òâ˼ÊÇÒ»ÑùµÄ£¬¾ÍÊÇ´¦ÀíÒ»¸ölist£¬Åöµ½ÌØÊâÇé¿öÉú³ÉÒ»¸öÐÂlist£¬×ª¶øÈ¥´¦ÀíÕâ¸öÐÂÉú³ÉµÄlist

ÒýÓÃ

ÒýÓà 1 Â¥ iambic µÄ»Ø¸´:

Ò»¡¢½ûÖ¹ÔÚfor±éÀúµÄʱºòÐ޸ı»±éÀúµÄ¶ÔÏó¡£
¶þ¡¢¾


Ïà¹ØÎÊ´ð£º

PythonÖеÄUnicodeÔÚDelphiÈçºÎ»¹Ô­³ÉGb2312£¿

ÒÑÖªPython ÖУº
s = unicode("²âÊÔ", "gb2312")
s = u'\u6d4b\u8bd5'
print s
²âÊÔ

ÔÚDelphiÀïÃæÈçºÎ½«\u6d4b\u8bd5ÕâÑùµÄ»¹Ô­³ÉGb2312µÄºº×ÖÄØ£¿
ÕÒµ½¸ö·½·¨
......

IIS 7 python 2.6 cgi ÎļþÉÏ´«ÎÊÌâ

ÎÒÿ´ÎÉÏ´«µÄÎļþ¶Áµ½µÄÊý¾Ý¶¼²»ÕýÈ·¡£2M µÄͼƬ¶ÁµÃ10¶àK ¡£¡£ÄÄλ´óÏÀ¿ÉÒÔ°ï°ïÎÒ°¡¡£
#!D:\ProgrammerTools\python26\python.exe
#encoding=utf-8
import cgitb
import os
cgitb.enable()
import cgi,urllib ......

È¡µÃPython´úÂë¶ÎµÄÕýÔò±í´ïʽ?

È磺
def aa(i):
print i
a=[1,2,3]
b=2
c=3
ÄÜʶ±ð³öÆðʼλdef aa(i):
ºÍ½áÊøÎ»" a=[1,2,3]"£¿
ÏñPython¶ÔÓï·¨ÕâôҪÇóÑϸñµÄÎÒ¾õµÃ¾Í²»ÒªÓÃÕýÔòÁË£¬Ð§Âʲ»¸ß¡£Ö±½ÓÓÃÅжϾͿÉÒÔÁË£¬Î ......

python winϵ÷ÓÃdll

  СµÜ½Ó´¥python 2¸öÐÇÆÚÁË£¬°²×°µÄÊÇpython3.1°æ¡£
ÎÒÓõÄÊÇwindows7£¬Ïëд¸öµ÷ÓÃdllµÄ³ÌÐòʵ¼ù¡£ÎÊÌâÀ´ÁË£º

C++´úÂ룺
extern "C" int __stdcall test();

int __stdcall te ......

PYTHON Ò»¸ö³ÌÐò£¬23ÐÐÓÐ´í£¬²»Ã÷°×Ϊʲô ¾´ÇëÖ¸½Ì£¡

Python code:

class Rectangle:
def __init__(self, width, height):
self.width = width
self.height = height
def paint(self, factory):
point = factory.getPoint()
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ