pythonÓï·¨ºÍ´úÂëÔ¼¶¨
1. µÚ¶þÕ Óï·¨¼°´úÂëÔ¼¶¨
±¾Õ½²ÊöÁËPython³ÌÐòµÄÓï·¨ºÍ´úÂëÔ¼¶¨¡£ ±¾ÕµÄÖ÷ÌâÓÐÐнṹ,Óï¾ä·Ö×é,±£Áô×Ö,×Ö·û´®,ÔËËã·û,tokenµÈµÈ,ÁíÍâ¶ÔÈçºÎʹÓÃUnicode ×Ö·û´®Ò²×öÁËÏêϸµÄÃèÊö¡£
Ŀ¼
1. µÚ¶þÕ Óï·¨¼°´úÂëÔ¼¶¨
1. Ðнṹ/Ëõ½ø
2. ±êʶ·û¼°±£Áô×Ö
3. Êý×Ö/ÎÄ×Ö
4. ÔËËã·û¡¢·Ö¸ô·û¼°ÌØÊâ·ûºÅ
5. Îĵµ×Ö·û´®
1.1. Ðнṹ/Ëõ½ø
³ÌÐòÖеÄÿ¸öÓï¾ä¶¼ÒÔ»»Ðзû½áÊø¡£Ìر𳤵ÄÓï¾ä¿ÉÒÔʹÓÃÐøÐзû(\)À´·Ö³É¼¸¸ö¶Ì
СµÄÐÐ,ÈçÏÂÀý:
import math
a = math,cos(3*(x-n)) + \
math,sin(3*(y-n))
µ±Ä㶨ÒåÒ»¸öÈýÒýºÅ×Ö·û´®¡¢ÁÐ±í¡¢tuple »òÕß×ÖµäµÄʱºò²»ÐèÒªÐøÐзûÀ´·Ö¸îÓï
¾ä¡£¼°¾ÍÊÇ˵,ÔÚ³ÌÐòÖÐ,·²ÊÇÔ²À¨ºÅ(,,,)¡¢·½À¨ºÅ[,,,]¡¢»¨À¨ºÅ{,,,}
¼°ÈýÒýºÅ×Ö·û´®ÄڵIJ¿·Ö¾ù²»ÐèҪʹÓÃÐøÐзû¡£
Ëõ½ø±»ÓÃÀ´Ö¸Ê¾²»Í¬µÄ´úÂë¿é,±ÈÈ纯ÊýµÄÖ÷Ìå´úÂë¿é,Ìõ¼þÖ´ÐдúÂë¿é,Ñ»·Ìå
´úÂë¿é¼°ÀඨÒå´úÂë¿é¡£Ëõ½øµÄ¿Õ¸ñ(ÖƱí·û)ÊýÄ¿¿ÉÒÔÊÇÈÎÒâµÄ,µ«ÊÇÔÚÕû¸ö¿éÖÐ
µÄËõ½ø±ØÐëÒ»ÖÂ:
¾¡¹ÜÔÊÐíÓÃÖƱí·ûָʾËõ½ø,ÎÒ»¹ÊÇҪ˵ÕâÊÇÒ»¸ö²»ºÃµÄÏ°¹ß¡£ ¼á¾ö²»Òª»ìºÏʹÓÃ
ÖƱí·ûºÍ¿Õ¸ñÀ´Ëõ½ø,Õâ»á¸øÄã´øÀ´ÒâÏë²»µ½µÄÂé·³¡£½¨ÒéÄãÔÚÿ¸öËõ½ø²ã´ÎÖÐʹ
Óõ¥¸öÖƱí·û»òÁ½¸ö»òËĸö¿Õ¸ñ¡£ÔËÐÐ PythonµÄʱºòʹÓà -t ²ÎÊý,Èç¹ûpython ·¢ÏÖ
´æÔÚÖƱí·ûºÍ¿Õ¸ñ»ìÓÃ,Ëü¾ÍÏÔʾ¾¯¸æÐÅÏ¢,ÈôʹÓà -tt ²ÎÊý python Ôò»áÔÚÓöµ½»ì
ÓÃÇé¿öʱÒý·¢TabErrorÒì³£¡£
·ÖºÅ(;)¿ÉÒ԰Ѷà¸öÓï¾ä·ÅÔÚͬһÐÐÖÐ,Ö»ÓÐÒ»¸öÓï¾äµÄÐÐÒ²¿ÉÒÔÓ÷ֺÅÀ´½áÊø¡£
#ָʾÕâÊÇÒ»¸öÑÓ³¤ÖÁÐÐÄ©µÄ×¢ÊÍ,µ«ÊÇ°üÔÚ×Ö·û´®ÄÚµÄ#ûÓÐÕâ¸ö¹¦ÄÜ¡£
×îºóҪ˵Ã÷µÄ,½âÊÍÆ÷»áºöÂÔËùÓеĿհ×ÐÐ(·Ç½»»¥Ä£Ê½ÏÂ)¡£
1.2. ±êʶ·û¼°±£Áô×Ö
±êʶ·ûÊÇÓÃÓÚʶ±ð±äÁ¿¡¢º¯Êý¡¢Àࡢģ¿éÒÔ¼°ÆäËû¶ÔÏóµÄÃû×Ö,±êʶ·û¿ÉÒÔ°üº¬×Ö
ĸ¡¢Êý×Ö¼°Ï»®Ïß(_),µ«ÊDZØÐëÒÔÒ»¸ö·ÇÊý×Ö×Ö·û¿ªÊ¼¡£×Öĸ½ö½ö°üÀ¨ISO-Latin×Ö
·û¼¯ÖеÄA–ZºÍa–z¡£±êʶ·ûÊÇ´óСдÃô¸ÐµÄ,Òò´Ë FOOºÍfooÊÇÁ½¸ö²»Í¬µÄ¶ÔÏó¡£
ÌØÊâ·ûºÅ,Èç$¡¢%¡¢@µÈ,²»ÄÜÓÃÔÚ±êʶ·ûÖС£ÁíÍâ,Èç if,else,for
Ïà¹ØÎĵµ£º
[root@pku-fan MySQL]# cat limbs.sql
CREATE DATABASE cookbook;
USE cookbook;
DROP TABLE IF EXISTS limbs;
CREATE TABLE limbs
(
thing VARCHAR(20), # what the thing is
legs INT, ......
תÔØ×Ô£ºhttp://hi.baidu.com/myitlyj/blog/item/25586bd7088ba3dba044df6b.html
ÔÚ³ÌÐòÖÐʹÓÃÅäÖÃÎļþÀ´Áé»îµÄÅäÖÃһЩ²ÎÊýÊÇÒ»¼þºÜ³£¼ûµÄÊÂÇ飬ÅäÖÃÎļþµÄ½âÎö²¢²»¸´ÔÓ£¬ÔÚpythonÀï¸üÊÇÈç´Ë£¬ÔÚ¹Ù·½·¢²¼µÄ¿âÖоͰüº¬ÓÐ×öÕâ¼þÊÂÇéµÄ¿â£¬ÄǾÍÊÇConfigParser£¬ÕâÀï¼òµ¥µÄ×öһЩ½éÉÜ¡£
ConfigParser½âÎöµÄÅäÖÃÎļþµÄ¸ñÊ ......
×î½üÏÂÔØÁËÒ»·Ý×îеÄpython3.0Íæ¶ù
ûÏëµ½print(Hello world)¾ÍÄÑΪÁËÎÒ°ëÌì
ÎÊÌâ1£¬printº¯Êý
ºóÀ´¿´ÁËһϸüеÄÎĵµ²ÅÖªµÀ£¬3.0ÒÔºóprintÒѾ±»·â×°³Éº¯ÊýÁË
¶øÎÒ»¹Ò»Ö±Ï°¹ß2.6µÄ print 'Hello World'ÐÎʽ£¬ º¹Ò»¸ö£¡
ÎÊÌâ2£¬notepadµÄutf8¸ñʽ
ÎÒʹÓÃnotepadдÁ˸ö²âÊÔÎļþ£¬±£´æΪutf8¸ñʽ
¸ñʽ´ó¸ÅÊÇ:
test& ......
1£¬²»ÓÃÐÞ¸Ä/etc/vimϵÄvimrc¼°gvimrcÎļþ ¡£¡£¡£
2£¬ÔÚ~Ŀ¼Ï£¬Ð½¨Ò»¸ö.vimrcµÄÅäÖÃÎļþ¡£ÄÚÈÝÈçÏ£º£¨¸ßÁÁ£¬×Ô¶¯¶ÔÆ룬×Ô¶¯Ëõ½ø£¬ÏÔʾÐкţ©
" An example for a vimrc file.
"
" Maintainer: Bram Moolenaar <Bram@vim.org>
" Last change: 2006 Nov ......
pythonÖÐÀàµÄÊôÐÔ
pythonÖеÄÀà½Ðclass object,ÀàµÄʵÀý½Ðinstance object.
Àà Class Objects
ÀàÓµÓÐÁ½ÖÖ²Ù×÷,1.ÀàÊôÐÔ attribute references 2.ʵÀý»¯instantiation
1.ÀàÊôÐÔ¾ÍÏ൱ÓÚרÊôÓÚÒ»¸öÀàµÄ±äÁ¿(¼´Ä³Ð©ÓïÑÔÖеÄÀàµÄ¾²Ì¬¹«¹²±äÁ¿static public),ʹÓ÷½·¨ÊÇ:ÀàÃû³Æ.ÀàÊôÐÔÃû³Æ
2.ʵÀý»¯ÔòÊÇ´´½¨Ò»¸öÀàµÄʵÀýµÄ· ......