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

Python 3.x (1):ÈëÃÅ

 
1 ÄãºÃ
#´ò¿ªÐ´°¿Ú,ÊäÈë:
#! /usr/bin/python
# -*- coding: utf8 -*- 
s1=input("Input your name:")
print("ÄãºÃ,%s" % s1)
'''
֪ʶµã:
    * input("ij×Ö·û´®")º¯Êý:ÏÔʾ"ij×Ö·û´®",²¢µÈ´ýÓû§ÊäÈë.
    * print()º¯Êý:ÈçºÎ´òÓ¡.
    * ÈçºÎÓ¦ÓÃÖÐÎÄ
    * ÈçºÎÓöàÐÐ×¢ÊÍ
'''    
2 ×Ö·û´®ºÍÊý×Ö
µ«ÓÐȤµÄÊÇ,ÔÚjavascriptÀïÎÒÃÇ»áÀíÏ뵱ȻµÄ½«×Ö·û´®ºÍÊý×ÖÁ¬½Ó,ÒòΪÊǶ¯Ì¬ÓïÑÔÂï.µ«ÔÚPythonÀïÓеã¹îÒì,ÈçÏÂ:
#! /usr/bin/python
a=2
b="test"
c=a+b
ÔËÐÐÕâÐгÌÐò»á³ö´í,ÌáʾÄã×Ö·û´®ºÍÊý×Ö²»ÄÜÁ¬½Ó,ÓÚÊÇÖ»ºÃÓÃÄÚÖú¯Êý½øÐÐת»»
#! /usr/bin/python
#ÔËÐÐÕâÐгÌÐò»á³ö´í,ÌáʾÄã×Ö·û´®ºÍÊý×Ö²»ÄÜÁ¬½Ó,ÓÚÊÇÖ»ºÃÓÃÄÚÖú¯Êý½øÐÐת»»
a=2
b="test"
c=str(a)+b
d="1111"
e=a+int(d)
#How to print multiply values
print ("c is %s,e is %i" % (c,e))
'''
֪ʶµã:
    * ÓÃintºÍstrº¯Êý½«×Ö·û´®ºÍÊý×Ö½øÐÐת»»
    * ´òÓ¡ÒÔ#¿ªÍ·,¶ø²»ÊÇϰ¹ßµÄ//
    * ´òÓ¡¶à¸ö²ÎÊýµÄ·½Ê½
    '''
3 Áбí
#! /usr/bin/python
# -*- coding: utf8 -*-
#ÁбíÀàËÆJavascriptµÄÊý×é,·½±ãÒ×ÓÃ
#¶¨ÒåÔª×é
word=['a','b','c','d','e','f','g']
#ÈçºÎͨ¹ýË÷Òý·ÃÎÊÔª×éÀïµÄÔªËØ
a=word[2]
print ("a is: "+a)
b=word[1:3]
print ("b is: ")
print (b) # index 1 and 2 elements of word.
c=word[:2]
print ("c is: ")
print (c) # index 0 and 1 elements of word.
d=word[0:]
print ("d is: ")
print (d) # All elements of word.
#Ôª×é¿ÉÒԺϲ¢
e=word[:2]+word[2:]
print ("e is: ")
print (e) # All elements of word.
f=word[-1]
print ("f is: ")
print (


Ïà¹ØÎĵµ£º

Python±Ê¼Ç£¨5£©

Ä£¿é
 
Ò».¼ò½é
Ä£¿é»ù±¾ÉϾÍÊÇÒ»¸ö°üº¬ÁËËùÓÐÄ㶨ÒåµÄº¯ÊýºÍ±äÁ¿µÄÎļþ¡£ÎªÁËÔÚÆäËû³ÌÐòÖÐÖØÓÃÄ£¿é£¬Ä£¿éµÄÎļþÃû±ØÐëÒÔ.pyΪÀ©Õ¹Ãû¡£
 
ÀýÈ磺
 
#!/usr/bin/python
# Filename: using_sys.py
import sys
print 'The command line arguments are:'
for i in sys.argv:
print i
print '\n ......

Python±Ê¼Ç£¨7£©

  Ò»¸öPython½Å±¾µÄ¿ª·¢È«¹ý³Ì
ÎÊÌ⣺Íê³ÉÒ»¸ö¿ÉÒÔΪÎÒÃÇËùÓеÄÖØÒª³ÌÐò×ö±¸·ÝµÄ³ÌÐò¡£
²½Öè²ð½â£º
ÐèÒª±¸·ÝµÄÎļþºÍĿ¼ÓÉÒ»¸öÁбíÖ¸¶¨¡£
Îļþ±¸·Ý³ÉÒ»¸özipÎļþ¡£
zip´æµµµÄÃû³ÆÊǵ±Ç°µÄÈÕÆÚºÍʱ¼ä¡£
ÎÒÃÇʹÓñê×¼µÄzipÃüÁËüͨ³£Ä¬ÈϵØËæLinux/Unix·¢ÐаæÌṩ¡£WindowsÓû§¿ÉÒÔʹÓÃInfo-Zip³ÌÐò¡£×¢Òâ ......

Python±Ê¼Ç£¨8£©

PythonµÄÃæÏò¶ÔÏóÐÔÖÊ
ÀàºÍ¶ÔÏóÊÇÃæÏò¶ÔÏó±à³ÌµÄÁ½¸öÖ÷Òª·½Ãæ¡£Àà´´½¨Ò»¸öÐÂÀàÐÍ£¬¶ø¶ÔÏóÕâ¸öÀàµÄ ʵÀý ¡£ÕâÀàËÆÓÚÄãÓÐÒ»¸öintÀàÐ͵ıäÁ¿£¬Õâ´æ´¢ÕûÊýµÄ±äÁ¿ÊÇintÀàµÄʵÀý£¨¶ÔÏ󣩡£
 
ÐèҪעÒâµÄÊÇ£¬ÔÚPythonÖУ¬¼´±ãÊÇÕûÊýÒ²±»×÷Ϊ¶ÔÏó£¨ÊôÓÚintÀࣩ¡£ÕâºÍC++¡¢Java£¨1.5°æÖ®Ç°£©°ÑÕûÊý´¿´â×÷ΪÀàÐÍÊDz»Í¬µÄ¡£Í¨¹ ......

PythonÖÐÎÄÈ«¹¥ÂÔ

http://blog.chinaunix.net/u1/59571/showart_1901962.html
1.        ÔÚPythonÖÐʹÓÃÖÐÎÄ
ÔÚPythonÖÐÓÐÁ½ÖÖĬÈϵÄ×Ö·û´®£ºstrºÍunicode¡£ÔÚPythonÖÐÒ»¶¨Òª×¢ÒâÇø·Ö“Unicode×Ö·û´®”ºÍ“unicode¶ÔÏó”µÄÇø±ð¡£ºóÃæËùÓеēunicode×Ö·û´®”Ö¸µÄ¶¼ÊÇpyt ......

PythonÍêÈ«ÐÂÊֽ̳Ì

http://www.cppblog.com/oosky/archive/2005/10/11/639.html
Lesson 1 ×¼±¸ºÃѧϰPythonµÄ»·¾³
Python µÄ¹Ù·½ÍøÖ·£º
www.python.org
µã»÷ÏÂÃæÁ¬½Ó¾Í¿ÉÒÔÖ±½ÓÏÂÔØÁË£¬ÕâÀïÖ»ÌṩÁËWindowsϵÄPython¡£
http://www.python.org/ftp/python/2.4.2/python-2.4.2.msi
linux°æ±¾µÄÎҾͲ»ËµÁË£¬ÒòΪÈç¹ûÄãÄܹ»Ê¹ÓÃlinux²¢°²×° ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ