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

pythonдÎļþʱ³öÎÊÌâ

Òì³£´úÂëÈçÏ£º
write a file error: [Errno 2] No such file or directory: 'C:\x0cile.txt'

Traceback (most recent call last):
  File "C:\Documents and Settings\USER\×ÀÃæ\¸´¼þ test.py", line 84, in <module>
    test()
  File "C:\Documents and Settings\USER\×ÀÃæ\¸´¼þ test.py", line 78, in test
    writefile(s)
  File "C:\Documents and Settings\USER\×ÀÃæ\¸´¼þ test.py", line 59, in writefile
    f.write(str(string))
UnboundLocalError: local variable 'f' referenced before assignment


Python code:

¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£¡£

def writefile(string):
strfile="C:\file.txt"
try:
f = open(strfile,'a')
except IOError,e:
print "write a file error:",e

f.write(str(string))
f.close()



def test():
fname = 'C:\ZLLKDoc.cpp'
#raw_input('Enter filename: ')
try:
fobj = open(fname, 'r')
except IOError, e:
print "*** file open error:", e
strFile=fobj.read()

fobj.close()

s = eraser(strFile)
print s





ʵÔÚ²»ÖªµÀÄÄÀï´íÁË£¬Çë´óÏÀÃÇ°ïæ¿´¿´£¬¸Ð¼¤²»¾¡
test£¨£© º¯ÊýÖеÚÒ»ÐмÓÈë global f
È»ºóÄãµÄÁ½¸öº¯ÊýµÄÂß¼­


Ïà¹ØÎÊ´ð£º

Ë­ÍƼöÒ»±¾Ñ§Ï°PYTHONµÄÊ飬лл

Ë­ÍƼöÒ»±¾Ñ§Ï°PYTHONµÄÊ飬лл
¡¶python¼òÃ÷½Ì³Ì¡·£¬¡¶pythonºËÐıà³Ì¡·

×÷Ϊϵͳ¹ÜÀí·½Ã棬¡¶Python UNIXºÍLinuxϵͳ¹ÜÀíÖ¸ÄÏ¡·ÊDZ¾·Ç³£²»´íµÄÊé¡£
http://club.book.csdn.net/pic3/255142.jpg

ÒýÓÃ
×÷Î ......

python 3.xµÄifÓï¾ä

>>> x=-1
>>> if x>0:
print ('11')

>>> else:

SyntaxError: invalid syntax (<pyshell#20>, line 1)
ÍøÉÏËѵÄÒ²ÊÇ£º
>>> x=int(input("Please ent ......

python±à¼­zipÎļþ

²ËÊÖÇë½ÌÖîλÀÏÄñ£º
ÎÒÏ£Íû±à¼­zipѹËõ°üÀïµÄÒ»¸öÎı¾Îļþ¡£Ôõô½â¾ö±È½ÏºÏÀí£¿
ÎÒµÄÏë·¨£ºÏÈ°ÑZIP½âѹ£¬Ôٱ༭Îı¾£¬È»ºóÔÙѹËõ³ÉZIP²¢°Ñ½âѹ¹ýµÄÎļþɾ³ý¡£²»¹ý¸Ð¾õÓÐЩ·±Ëö£¬¿É²»¿ÉÒÔÖ±½Ó¶ÁZIPÈ»ºóÐÞ¸ÄÄØ£¿ ......

Python ÖÐÈçºÎдif

python

content=str.find('ok')  &&  content=str.find('not ok')

ÕâÑù±íʾ ÔÚÄÚÈÝÖÐÕÒµ½ ok  »òÕß ÕÒµ½ not ok ¶ÔÂð£¿
²¢ÁÐÌõ¼þÓà and ¶ø²»ÊÇ&& ......

C# RSA Python - .NET¼¼Êõ / C#

C#ÀïÃæÓÃusing System.Security.Cryptography; RSACryptoServiceProvider¼ÓÃܹýµÄÏûÏ¢
ÓÃPython CryptoÖÐRSAµÄ·½·¨ ÄÜÖ±½Ó ½âÂð£¿
RSA¼ÓÃÜ·½Ê½²»ÊÇͳһµÄÂð£¿ÐèҪעÒâЩʲô£¿

ÓаïÖú¡£µ«ÊÇû½â¾öÎÊÌâ¡£¡£¡£
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ