|
|
°Ñ¦Ò¤â¥U (¦Û°Ê²£¥Í)
- __¤º«Ø__
- ¦r¦ê
- §Ç¦C
- ¦r¨å
- ÀÉ®×
- ¨t²Î ¼Ò²Õ
- ²§±`
«÷¹ï |
«÷¹ï(§Ç¦C1 [, §Ç¦C2 [...]]) -> [(§Ç¦C1[0], §Ç¦C2[0] ...), (...)]
¶Ç¦^¤@Ó¤¸¯À²Õªº¦Cªí, §Ç¦C¤¤²Ä i Ó¤¸¯À²Õ§t¦³©Ò¦³°Ñ¼Æ§Ç¦Cªº²Ä i Ó¤¸¯À.
¶Ç¦^ªº§Ç¦Cªºªø«×¬°°Ñ¼Æ§Ç¦C¤¤³Ìµuªº¬°·Ç. |
Åܼƪí |
Åܼƪí([¹êÅé]) -> ¦r¨å
¨S¦³°Ñ¼Æ¤U, µ¥©ó locals/¨p¦³ÅܼÆ().
¦³°Ñ¼Æ¤U, µ¥©ó ¹êÅé.__¦r¨å__/object.__dict__ |
¨t²Î²§±` |
Python ¤º³¡¥X¿ù
½Ð§â³o¶µ²§±`¥H¤Î²§±`°lÂÜ©Mª©¥»,µwÅé/¾Þ§@¨t²Îµ¥
¸ê®Æ³ø§iµ¹¦³ÃöªººûÅ@¤Hû |
ºâ³N²§±` |
ºâ³N²§±`ªº©³¼h·§©À |
¤º®e |
¤º®e([¹êÅé]) -> ¦r¦ê§Ç¦C
©M Á`¤º®e([¬Û¦P]) ¦ý¶Ç¦^ªº¥u¬O¤¤¤å³¡¤À. |
__¸ü¤J__ |
__¸ü¤J__(¦WºÙ, ¦@¥ÎÅܼÆ, ¨p¦³ÅܼÆ, ¸ü¤J¦WºÙ§Ç¦C) -> ¼Ò²Õ
¸ü¤J¼Ò²Õ. ¦@¥ÎÅܼưѼƥu¬O¥Î¨Ó¨M©w¹Bºâ°ì¦Ó¤º®e¤£·|³Q§ïÅÜ;
¨p¦³ÅܼưѼƼȮɨS¦³¥Î¨ì. ²Ä 3 ӰѼƬO¤@ӧǦC,
¥Î¨Ó¼ÒÀÀ ``±q ¦WºÙ ¸ü¤J ..../from name import ...'',
¦pªG¬OªÅªº§Ç¦C«hªí¥Ü ``¸ü¤J ¦WºÙ/import name''.
±q®M¥ó¤¤¸ü¤J¼Ò²Õ®É, ª`·N __¸ü¤J__('A.B', ...)
·í¦WºÙ§Ç¦C°Ñ¼Æ¬OªÅ§Ç¦C®É·|¶Ç¦^®M¥ó A , ·í¸Ó°Ñ¼Æ
¤£¬OªÅªº§Ç¦C®É«h¶Ç¦^ B. |
__»¡©ú__ |
¹ïÀ³ |
¹ïÀ³(¨ç¼Æ, §Ç¦C[, §Ç¦C, ...]) -> §Ç¦C
½Õ¥Î¨ç¼Æ '¨ç¼Æ', ½Õ¥Î®Éªº°Ñ¼Æ¨ú¦Û '§Ç¦C'.
¦pªGµ¹¥X¦hӧǦC«h·|¨Ì¦¸½Õ¥Î '¨ç¼Æ', ¨Ã§â©Ò¦³ªº¨ç¼Æ¶Ç¦^ȶ¶§Ç©ñ¨ì '§Ç¦C'¤¤.
¦pªG§Ç¦Cªºªø«×¤£¤@P«h·|¥H 'µL'/'None' ¨Ó¶ñ¸É.
¦pªG¥H 'µL'/'None' §@¬° '¨ç¼Æ', «h¶Ç¦^ '§Ç¦C',
©ÎªÌ·í¦³¶W¹LӧǦC®É¶Ç¦^¤@Ó¥]§t¤¸¯À²Õªº§Ç¦C. («z, ³s§Ú¦Û¤v¤]¦³ÂI½k¶î¤F.) |
¥i©I¥s |
¥i©I¥s(¹êÅé) -> ¯uÈ
¦p¹êÅé¬O¥i³Q·í§@¨ç¼Æ¨Ó½Õ¥Îªº¸Ü«h¶Ç¦^¯u.
ª`·N¦pªG¹êÅ骺©w¸q¤¤¦³ __call__/©I¥s() ³oÓ¯S®í¤èªkªº¸Ü«h¸Ó¹êÅé·|¦¨¬°¥i©I¥sªº. |
¥Î¤áĵ§i |
¥Î¤á©w¸qªºÄµ§iÃþªº©³¼h·§©À |
½Æ¼Æ |
½Æ¼Æ(¹ê³¡[, µê³¡]) -> ½Æ¼Æ
®Ú¾Ú°Ñ¼Æªº¹ê³¡©Mµê³¡²£¥Í¤@Óµê¼Æ¼Æ¾Ú.
¬Û·í©ó (¹ê³¡ + µê³¡*1j). ¨ä¤¤µê³¡ªº¹w³]Ȭ° 0. |
²Î¤@½X |
²Î¤@½X(¦r¦ê [, ½s½X[, ¿ù»~³B²z]]) -> ¹êÅé
®Ú¾Ú°Ñ¼Æ¨Ó²£¥Í¤@ӲΤ@½X½s½Xªº¦r¦êÃþ.
½s½Xªº¹w³]ȬO¨t²Îªº¹w³]½s½X.
¦Ü©ó¿ù»~³B²z¿ï¶µ«h¬° 'strict'. |
¨p¦³ÅÜ¼Æ |
¨p¦³ÅܼÆ() -> ¦r¨å
¶Ç¦^¥Ø«e¹Bºâ°ì¤¤ªº¥»¦aÅܼƪí. |
¬Ù²¤¸¹ |
¤ñ¸û |
¤ñ¸û(¥Ò, ¤A) -> ¼Æ¦r
¦p ¥Ò < ¤A ¶Ç¦^tÈ, ¥Ò¤A¬Ûµ¥¶Ç¦^ 0 , ¥Ò > ¤A «h¶Ç¦^¥¿È. |
¤Q¤»¶i |
¤Q¤»¶i(¼Æ¦r) -> ¦r¦ê
¶Ç¦^¥H¤Q¤»¶i¨îªí¥Üªº¼Æ¦rÈ |
¤K¶i |
¤K¶i(¼Æ¦r) -> ¦r¦ê
¶Ç¦^¾ã¼Æ°Ñ¼Æªº¤K¶i¨îªí¥Ü¦¡. |
¥yªkĵ§i |
µo¥X¥yªk¿ù»~ĵ§iªº©³¼h·§©À |
®M¥Î |
®M¥Î(¹êÅé[, °Ñ¼Æ[, ¦r¨åÃþ°Ñ¼Æ]]) -> È
½Õ¥Î¤@Ó¥i©I¥sªº°Ñ¼Æ '¹êÅé', ¨ä½Õ¥Îªº°Ñ¼Æ¨ú¦Û '°Ñ¼Æ',
©Î '¦r¨åÃþ°Ñ¼Æ'.
ª`·N¥i¦b©w¸q¹êÅé®É¥[¤J __call__/__©I¥s__() ¤èªk¨Ó¹êÅéÅܦ¨¥i³Q½Õ¥Î. |
¼Ð·Ç²§±` |
©Ò¦³¤¤Á¯¼Ð·Ç²§±`Ȫº©³¼h·§©À |
Â_¨¥²§±` |
¤£¯à³q¹LÀËÅç |
¦P¤Æ |
¦P¤Æ(¥Ò, ¤A) -> µL ©Î (¥Ò1, ¤A1)
¦p '¥Ò' '¤A' ¥i¥HÂà´«¦¨¦P¤@Ãþ«¬ªº¼Æ¾Ú«h¶Ç¦^¤¸¯À²Õ, ¨ä¤¤¥]¬AÂà´««áªºÈ.
¦p¤£¯àÂà´«¦¨¦P¤@Ãþ«¬«h¶Ç¦^ 'µL'/None. |
Ãþ«¬ |
Ãþ«¬(¹êÅé) -> Ãþ«¬
¶Ç¦^¹êÅ骺Ãþ«¬. |
__°£¿ù__ |
°h¥X¨t²Î |
n¨DÂ÷¶}¤¬°Ê¼Ò¦¡ |
__¦WºÙ__ |
¥N¸¹ |
¥N¸¹(¹êÅé) -> ¾ã¼Æ
¶Ç¦^°Ñ¼Æ¹êÅ骺¨¥÷¸¹½X. ³oÓ¥N¸¹«OÃÒ¹ï©ó¦P®É¦s¦bªº¹êÅéÃþ¤]¬O¿W¤@µL¤Gªº.
(´£¥Ü: ¥¦°ò¥»¤W¥Nªí¤F¸Ó¹êÅ骺°O¾ÐÅé¦ì§}, ¦]¦¹¬Û¦P¥N¸¹ªº¹êÅ饲©w¬O«ü¦P¤@Ó¹êÅé) |
¤w¹L®Éªº¥Îªk |
¨Ï¥Î¤Fªº¥\¯àªºÄµ§iªº©³¼h·§©À |
°õ¦æ¤å¥ó |
°õ¦æÀÉ®×(ÀɦW[, ¦@¥ÎÅܼÆ[, ¨p¦³ÅܼÆ]])
Ū¤J¨Ã°õ¦æÀɮפ¤ªºµ{¦¡¤º®e.
¦@¥ÎÅܼƩM¨p¦³ÅܼƬ°¦r¨åÃþÅܼÆ, ¹w³]ªºÈ
´N¬O¥Ø«e¹Bºâ°ì¤¤ªºÈ. ¦pªG¥uµ¹¥X¦@¥ÎÅܼƪº¸Ü«h
¨p¦³ÅܼƳ]¦¨©M¥¦¤@¼Ë. |
¾ã¼Æ |
¾ã¼Æ(x) -> ¾ã¼Æ
¾ã¼Æ(x, °ò©³) -> ¾ã¼Æ
§â¦r¦ê©Î¼Æ¦rÂà´«¦¨¾ã¼Æ«¬ºA.
¯BÂI«¬ªº¼Æ¦r·|´«¦¨¾ã¼Æ«¬. (ª`·N³o¤£¥]¬A¦r¦ê«¬ºAªí¥Üªº¯BÂI¼Æ.
¦pªGÂà´«ªº¬O¦r¦ê, «h·|¥Hµ¹¥Xªº '°ò©³' §@¬°Âà´«ªº¼Æ¨t.
¦pªGÂà´«ªº¤£¬O¦r¦ê, «h¤£¯à¥Î '°ò©³' °Ñ¼Æ¤F. |
¦³ÄÝ©Ê |
¦³ÄÝ©Ê(¹êÅé, ¦W¦r) -> ¯uÈ
¦p°Ñ¼Æ¹êÅ餤¦³ '¦W¦r' ³oÓÄÝ©Ê«h¶Ç¦^¯u, §_«h¶Ç¦^°².
(°µªk¬O½Õ¥Î ŪÄÝ©Ê(¹êÅé, ¦W¦r) µM«áÀˬd¦³¨S¦³¤Þµo²§±`. |
Ȳ§±` |
°Ñ¼ÆȪºÃþ§O¤£¹ï |
Áä½L¤¤Â_ |
¨Ï¥ÎªÌn¨D²×¤îµ{¦¡¹B¦æ |
ÅܧǦC |
ÅܧǦC(§Ç¦CÃþ) -> §Ç¦C
¶Ç¦^°Ñ¼Æ '§Ç¦CÃþ' Åܦ¨§Ç¦C«áªºÈ. |
°Ó¾l¼Æ |
°Ó¾l¼Æ(x, y) -> (°Ó, ¾l¼Æ)
¶Ç¦^¤¸¯À²Õ, ¤º®e¬° ((x-x%y)/y, x%y). ª`·N¦³³oÓ©T©wÃö«Y: div*y + mod == x. |
²Î¤@½X¦r |
²Î¤@½X¦r(i) -> ²Î¤@½X¦r²Å
¶Ç¦^¤@Ó¦r¤¸ªº²Î¤@½X¦r¦ê. ¨ä§ÇȬ° i; 0 <= i < 65536. |
¯Á¤Þ²§±` |
¯Á¤ÞȦb§Ç¦C½d³ò¥H¥~ |
¿é¤J/¥X²§±` |
ª©Åv |
©|¥¼®¹¸j |
³oÓ°Ï°ìÅܼÆÁÙ¨S¦³È |
°£¹s²§±` |
°£ªk©Îºâ¾l¼Æªºpºâ¤¤°£¼Æ¬°¹s |
¤º¦s |
¤º¦s(¦r¦ê) -> ¦r¦ê
``Intern/¤º¦s¥N'' µ¹¥Xªº°Ñ¼Æ¦r¦ê. ³o¼Ë°µ·|§â¸Ó¦r¦ê¥[¨ì (¦@¥Îªº)
¤º¦s¤Æ¦r¦êªí¤§¤¤, °µ¦r¨å¯Á¤Þªº¬d§ä®É³t«×·|§Ö¤@¨Ç.
¶Ç¦^¦r¦ê¥»¨, ¦pªG¦b«e±ªº¾Þ§@¤w¸g¤º¦s¤Æ¤F¬Û¦Pªº¦r¦ê«h¶Ç¦^¥ý«eªºÈ. |
³]ÄÝ©Ê |
³]ÄÝ©Ê(¹êÅé, ¦WºÙ, È)
¦b°Ñ¼Æ¹êÅ餤¥[¤J¤@ÓÄÝ©Ê; ³]ÄÝ©Ê(x, 'y', v)
µ¥¦P©ó ``x.y = v''. |
«¸ü |
«¸ü(¼Ò²Õ) -> ¼Ò²Õ
«·s¥[¸ü¤@Ó¤w¸ü¤Jªº¼Ò²Õ. ¼Ò²Õ¥²¶·¦b¦«e¦¨¥\¸ü¤J¹L. |
§RÄÝ©Ê |
§RÄÝ©Ê(¹êÅé, ¦WºÙ)
§R°£¹êÅ餤 '¦WºÙ' ³oÓÄÝ©Ê; §RÄÝ©Ê(x, 'y')
µ¥¦P©ó ``del x.y''. |
¸õ®æ²§±` |
ªÅ®æ©M¸õ®æ²V¦X¨Ï¥Îªº¤£·í |
¤Æ² |
¤Æ²(¨ç¼Æ, §Ç¦C[, °_©lÈ]) -> È
°Ñ¼Æ '¨ç¼Æ' ¬O¤@ÓŪ¨ú¨âӰѼƨöǦ^¤@ÓȪº¾Þ§@. ¸Ó¨ç¼Æ·|
²Ö¿n¦a±q¥ª¨ì¥k§@¥Î¦b '§Ç¦C' ¤W¨Ã¶Ç¦^³Ì«áªºµ²ªGÈ.
¨Ò¦p: ¤Æ²(lambda x, y: x+y, [1, 2, 3, 4, 5]) ·|pºâ
((((1+2)+3)+4)+5). ¦pªGµ¹¥X°Ñ¼Æ '°_©lÈ', ¦bpºâ®É¸ÓÈ·|¥[¨ì§Ç¦C¤¤§@¬°
²Ä¤@Ó¤¸¯À, ¨Ã¥B¦b§Ç¦C¬OªÅªº±¡ªp¤U§@¬°¹wpÈ. |
¼È¦s |
¼È¦s(¹êÅé [, °¾²¾È[, ¤j¤p]]) -> ¹êÅé
®Ú¾Úµ¹¥Xªº '¹êÅé' °Ñ¼Æ²£¥Í¤@Ó·sªº½w½Ä¼È¦s¹êÅé.
¸Ó¼È¦s·|¥Nªí¥Ø¼Ð¹êÅ骺¤@Ó¤Á¤ù, ±q¹êÅ骺¶}©l¦ì¸mºâ°_,
(¦pªG¦³µ¹¥X '²¾´ÓÈ' «h±q¸Ó¦ì¸m¶}©lºâ)
¸Ó¤Á¤ùÃþ·|¤@ª½¨ì '¹êÅé' ªº¥½ºÝ.
(°£«D¦b°Ñ¼Æ '¤j¤p' ¤¤«ü©w¤F¤Á¤ùªºªø«×). |
¦@¥ÎÅÜ¼Æ |
¦@¥ÎÅܼÆ() -> ¦r¨å
¶Ç¦^¥Ø«eªº¹Bºâ°ì¤¤ªº¦@¥ÎÅܼƪí. |
µ´¹ïÈ |
µ´¹ïÈ(¼Æ¦r) -> ¼Æ¦r
¶Ç¦^¼Æ¦rªºµ´¹ïÈ (¥h±¼¥¿t¸¹ªº¼ÆÈ). |
¬d§ä²§±` |
´M§ä²§±`ªº©³¼h·§©À |
¨Ï¥Îµý |
¥|ªÙ |
¥|±Ë(¼Æ¦r[, ¤p¼Æ¦ì]) -> ¯BÂI¼Æ
¶Ç¦^°Ñ¼Æ '¼Æ¦r' ¥|±Ë¤¤J¨ì '¤p¼Æ¦ì'. (¹w³]ªº¤p¼Æ¦ì¬° 0).
¶Ç¦^ªºÈ¤@©w¬O¯BÂI¼Æ. ºë½T«×¥i¥H¬°t¼Æ |
¯BÂI¼Æ |
¯BÂI¼Æ(x) -> ¯BÂI¼Æ
¥i¯àªº¸Ü, §â°Ñ¼Æ¦r¦ê©Î¼Æ¥Ø¦rÅܦ¨¯BÂI¼Æ. |
¥´¶} |
¥´¶}(ÀɦW[, ¼Ò¦¡[, ½w½Ä]]) -> ÀÉ®×Ãþ
¥´¶}¤@ÓÀÉ®×. ¼Ò¦¡¥i¥H¬O 'r', 'w', 'a' ¥NªíŪ¤J (¹w³]È),
¼g¥X, ¥H¤Î ªþ¥[. ¦b¼g¥X¤Îªþ¥[ªº¼Ò¦¡¤U¦pªG¨S¦³¸ÓÀɮ׫h·|²£¥Í¤@Ó·sªºÀÉ®×.
°²¦p¤w¸g¦³¦P¦WÀɮצs¦b¨º¦b¼g¥X¼Ò¦¡¤UÂÂÀÉ®×·|³QÂл±¼.
nŪ¤G¶i¦ìÀɮɽХ[¤W¤@Ó 'b' ¦r. n¦P®ÉŪ¼g«h¥i¥H¥[¤W '+' ²Å¸¹.
'½w½Ä' È: 0 ¥Nªí¤£¥Î¼È¦s, 1 ¥Nªí¼È¦s¤@¦æ¤º®e,
¤j©ó¤@ªº¼Æªí¥Ü¸Ó½w½Äªº¤j¤p. |
ĵ§i |
ĵ§iÃþªº©³¼h·§©À |
²½d³ò |
²½d³ò([©l,] ²×[, ¨B¶i]) -> ²½d³òÃþ¹êÅé
©M ½d³ò() ¬Û¦ü, ¦ý¶Ç¦^ªº¤£¬O¤@ӧǦC¦Ó¬O¤@Ó¹êÅé,
¸Ó¹êÅé·|¨Ì»Ýn¦Ó²£¥Í¬Û¹ïÀ³ªº½d³ò¤¤ªº¼Æ¦r.
©M ½d³ò() ¬Û¸ûnºC¤@¨Ç¦ý¬O¸`¬Ù¤£¤Ö°O¾ÐÅé. |
«÷´~È |
«÷´~È(¹êÅé) -> ¾ã¼Æ
¶Ç¦^¹êÅ骺«÷´~È. ¬Û¦Pªº¹êÅ馳¬Û¦Pªº«÷´~È.
¨âÓ¹êÅ馳¬Û¦Pªº«÷´~È«Ü¥i¯àªí¥Ü¥¦Ì¬O¬Û¦Pªº, ¦ý¨Ã¤£«OÃÒ¤@©w¬Û¦P. |
©|¥¼§¹¤u |
³Ì¤j |
³Ì¤j(§Ç¦C) -> È
³Ì¤j(a, b, c, ...) -> È
¦pªG¥u¦³¤@ӧǦC°Ñ¼Æ, ¶Ç¦^¸Ó°Ñ¼Æ¤¤ªº³Ì¤j¤¸¯À.
¦pªG¶W¹L¤@ӰѼÆ, ¶Ç¦^©Ò¦³°Ñ¼Æ¤¤³Ì¤jªº¤@Ó. |
ŪÄÝ©Ê |
ŪÄÝ©Ê(¹êÅé, ¦WºÙ[, ¹w³]È]) -> È
¦b°Ñ¼Æ¹êÅ餤Ū¨ú '¦WºÙ' ÄÝ©Ê; ŪÄÝ©Ê(x, 'y') ¬Û·í©ó x.y
¹w³]È¥Nªí¤F¦pªG§ä¤£¨ì¸Ó¶µÄݩʪº¶Ç¦^È.
¦p¨S¦³ '¹w³]È' ³oӰѼƫh§ä¤£¨ì¸ÓÄÝ©Ê·|¤Þµo²§±`. |
ªø«× |
ªø«×(¹êÅé) -> ¾ã¼Æ
¶Ç¦^§Ç¦C©Î¦r¨åÃþ¤¤ªº¤¸¯À¼Æ¥Ø, ¦r¦êªºªø«×¥H¤Î¦³©w¸qªø«×ªº¹êÅ骺¤j¤p. |
¨D¾ |
¾(x, y[, z]) -> ¼Æ¦r
¨âӰѼƪº±¡ªp¤U¬Û·í©ó x**y. ¤TӰѼƪº±¡ªp¤U,
¬Û·í©ó (x**y) % z, ¦b¼Æ¦r¬Û·í¤jªº®É·|¸û (x**y) % z §ó°ª®Ä. |
Àô¹Ò²§±` |
¿é¤J/¿é¥XÃþ²§±`ªº©³¼h·§©À |
Åܦr¦ê |
Åܦr¦ê(¹êÅé) -> ¦r¦ê
¥H¦r¦êªº«¬ºAªí¥Ü°Ñ¼Æª«.
¦pªG°Ñ¼Æ¥»¨Ó´N¬O¦r¦êÃþ«h¶Ç¦^°Ñ¼Æ¥»¨. |
²Î¤@½X²§±` |
©M Unicode ¦³Ãöªº²§±` |
¹LÂo |
¹LÂo(¨ç¼Æ, §Ç¦C) -> §Ç¦C
°Ñ¼Æ '¨ç¼Æ' ¨ú¤@ӰѼƨöǦ^¯uÈ. ¹LÂo«áªº§Ç¦C·|¥]¬A
°Ñ¼Æ§Ç¦C¤¤¨Ï '¨ç¼Æ' ¶Ç¦^¯uªº¤¸¯À. |
³Ì¤p |
³Ì¤p(§Ç¦C) -> È
³Ì¤p(a, b, c, ...) -> È
¥u¦³¤@ӧǦC°Ñ¼Æ¤U, µ¹¥X§Ç¦C¤¤³Ì¤pªº¤¸¯À.
¦pªG¦³¨âÓ©Î¥H¤W°Ñ¼Æ«h¶Ç¦^©Ò¦³°Ñ¼Æ¤¤ªº³Ì¤jÈ. |
·¸È²§±` |
µ²ªG¤Ó¤j¤FµLªkªí¥Ü |
¦r½X |
¦r½X(c) -> ¾ã¼Æ
¶Ç¦^³æ¦r¤¸¦r¦êªº¦r½X. (¤p©ó 127 ªº«h¬O¸Ó¦r¤¸ªº ASCII ½X) |
µL |
¬O¤l·§©À |
¬O¤l·§©À(C, B) -> ¯u©Î°²
¦p C ¬O B ·§©Àªº¤l·§©À(Ä~©ÓÃö«Y)«h¶Ç¦^ 1, §_«h¶Ç¦^ 0. |
ÁäȲ§±` |
§ä¤£¨ì³oÓÁäÈ |
©|¥¼¤ä´© |
³oӥΪk©Î¦¹Ãþ¨ç¼Æ©|¥¼°µ¥X¨Ó |
ÁY±Æ²§±` |
µ{¦¡ªºÁY±Æ®æ¦¡§Ë¿ù¤F |
Åܤ¸¯À²Õ |
Åܤ¸¯À²Õ(§Ç¦CÃþ) -> §Ç¦C
¶Ç¦^¤¸¯À²Õ, ¨ä¤¤¤¸¯À©M°Ñ¼Æ§Ç¦C¤¤ªº¤@¼Ë.
¦pªG°Ñ¼Æ¥»¨¤w¬O¤¸¯À²Õ,«h¶Ç¦^°Ñ¼Æ¥»¨. |
¹B¦æ®Éĵ§i |
µo¥X¹B¦æ®É²§±`ĵ§iªº©³¼h·§©À |
±Àºâ |
±Àºâ(µ{¦¡½X[, ¦@¥ÎÅܼÆ[, ¨p¦³ÅܼÆ]]) -> È
¦@¥ÎÅܼƩM¨p¦³ÅܼƬ°¶i¦æ±Àºâ®É©Ò¥Îªº¹Bºâ°ì, ¬°¦r¨å«¬ºA.
µ{¦¡½X¥i¥H¬O¤¤Á¯ªº¦¡½X (¦r¦ê§Î¦¡) ©Î¬O¥Î
½sĶ/compile() ¶Ç¦^ªº½XÃþ«¬¼Æ¾Ú.
¹Bºâ°ìªº¹w³]ȬO¥Ø«eªº¹Bºâ°ì, ¦pªG¥uµ¹¥X¦@¥ÎÅܼƫh¨p¦³ÅܼÆ
·|³]¦¨©M¥¦¤@¼Ë. |
½sĶ |
½sĶ(µ{¦¡½X, ÀɦW, ¼Ò¦¡) -> ½XÃþ«¬¹êÅé
½sĶµ{¦¡½X(¦r¦ê«¬ºA), ¥i¥H¬O¤¤Á¯ªº¼Ò²Õ, ªí¹F¦¡©Î»y¥y.
¶Ç¦^ªºµ²ªG¬°¤@Ó½XÃþ§O, ¥i¥H§@¬° °õ¦æ() ©ÎªÌ ±Àºâ() ªº½Õ¥Î°Ñ¼Æ.
'ÀɦW'ªº§@¥Î¬O¥Î¨Ó©ñ¿ù»~°T®§ªº.
°Ñ¼Æ '¼Ò¦¡' ¶·¬°¥H¤UÈ: ¦pªG¬O¼Ò²Õ«h¥Î 'exec/°õ¦æ',
¦p¬O¤@Ó«ü¥O»y¥y«h¥Î 'single/³æ¦æ',
¦p¬O¤@Óªí¹F¦¡«h¥Î 'eval/±Àºâ'. |
¸ü¤J²§±` |
µLªk¸ü¤J¼Ò²Õ©Î¼Ò²Õ¦WºÙ¤£¦s¦b |
¤j¾ã¼Æ |
¤j¾ã¼Æ(x) -> ¤j¾ã¼Æ
¤j¾ã¼Æ(x, °ò©³) -> ¤j¾ã¼Æ
§â¦r¦ê©Î¼Æ¦rÂà´«¦¨¤j¾ã¼Æ«¬ºA.
¯BÂI«¬ªº¼Æ¦r·|´«¦¨¾ã¼Æ«¬. (ª`·N³o¤£¥]¬A¦r¦ê«¬ºAªí¥Üªº¯BÂI¼Æ.
¦pªGÂà´«ªº¬O¦r¦ê, «h·|¥Hµ¹¥Xªº '°ò©³' §@¬°Âà´«ªº¼Æ¨t.
¦pªGÂà´«ªº¤£¬O¦r¦ê, «h¤£¯à¥Î '°ò©³' °Ñ¼Æ¤F. |
Äݩʲ§±` |
¨S³oÓÄÝ©Ê |
»ïÁ |
°O¾ÐÅ鲧±` |
°O¾ÐÅ餣°÷¤F |
Àɮײ׵²²§±` |
¤w¶W¹L¤FÀɮקÀºÝ |
¦r¤¸ |
¦r¤¸(i) -> ¦r¤¸²Å
¶Ç¦^¤@Ó¦r¤¸ªº¦r¦ê, ¨ä§ÇȬ° i; 0 <= i < 256. |
¯BÂI²§±` |
¯BÂI¼Æ¾Þ§@¥¢±Ñ |
¬O¹êÅé |
¬O¹êÅé(¹êÅé, ·§©À©ÎÃþ«¬) -> ¯uÈ
¦p '¹êÅé' ¬O¬Y·§©À©Î¨ä¤Þ¥Ó·§©Àªº¹ê²{«h¶Ç¦^¯u.
¦pµ¹¥X²Ä 2 ӰѼÆ, «h¶Ç¦^ '¹êÅé' ¬O§_©M¸Ó°Ñ¼Æ(¹êÅé©Î¼Æ¾ÚÃþ)Ãþ«¬¬Û¦P. |
¾Þ§@¨t²Î²§±` |
½Õ¥Î¾Þ§@¨t²Î¨ç¼Æ¥¢±Ñ |
Ū¤J |
Ū¤J([´£¥Ü¥y]) -> ¦r
±q¼Ð·Ç¿é¤J¸Ë¸mŪ¨ú¤@Ó¦r¦ê. µ²§Àªº´«¦æ²Å¸¹·|³Qµô¥h.
¦pªG¥Î¤á¦b¿é¤J®ÉÁä¤J EOF °O¸¹ (Unix: Ctl-D, Windows: Ctl-Z+Return),
«h¤Þµo Àɮײ׵²²§±`/EOFError.
¦b Unix, ¦pªG¥i¯àªº¸Ü·|¨Ï¥Î GNU readline. '´£¥Ü¥y' ·|¥ýÅã¥Ü¥X¨Ó,
µM«á¦A¥t°_¤@¦æ¤~¶i¦æŪ¨ú¾Þ§@. |
½d³ò |
½d³ò([©l,] ²×[, ¨B¶i]) -> ¾ã¼Æ§Ç¦C
¶Ç¦^¤@ӧǦC, ¸Ó§Ç¦C¤¤¥]§t¶¶§Ç±Æ¦Cªººâ³N¯Å¼Æ¦C.
½d³ò(¥Ò, ¤A) ªí¥Ü [¥Ò, ¥Ò+1, ¥Ò+2, ..., ¤A-1]; '©l' (!) ªºÈ¹w³]¬° 0.
¦pªGµ¹¥X°Ñ¼Æ '¨B¶i', «hªí¥Ü§Ç¦C¤¤¬Û¾F¼Æªº®t.
¨Ò¤l: ½d³ò(4) ªí¥Ü [0, 1, 2, 3]. ª`·N½d³ò¤¤¨Ã¤£¥]¬A '4'! |
²§±` |
¦¹¬°©Ò¦³²§±`Ȫº©³¼h·§©À |
¦WºÙ²§±` |
µLªk§ä¨ì³oÓ¦W¦r |
¥H¤å¦rªí¥Ü |
¥H¤å¦rªí¥Ü(¹êÅé) -> ¦r¦ê
¶Ç¦^°Ñ¼Æ '¹êÅé' ¥¿³Wªº¦r¦êªí¥Ü.
¹ï¤j³¡¤À¹êÅé¨Ó»¡ ±Àºâ(¥H¤å¦rªí¥Ü(¹êÅé)) == ¹êÅé / eval(repr(object)) == object. |
°õ¦æ²§±` |
°õ¦æ¤¤¹J¨ì·N®Æ¤£¨ìªº²§±` |
¤Á¤ù |
¤Á¤ù([©l,] ²×[, ¨B¶i]) -> ¤Á¤ùÃþ
²£¥Í¤@Ó¤Á¤ùÃþ¹êÅé. ³o¥i¥Hµ¹ Numeric extensions(¼ÆÈÂX®i¼Ò²Õ) ¥Îªº. |
Á`¤º®e |
Á`¤º®e([¹êÅé]) -> ¦r¦ê§Ç¦C
¶Ç¦^¦r¦ê§Ç¦C. ¸Ó§Ç¦C¤¤¥]§t°Ñ¼Æ¹êÅ餤 (¦ý¤£¬O¥þ³¡) ªºÄÝ©Ê.
¦pªG¨S¦³µ¹¥X°Ñ¼Æ«h¶Ç¦^¥Ø«e¹Bºâ°ì¤¤©w¸qªºÅܼÆ,¦WºÙ.
¦pªG°Ñ¼Æ¬O¹êÅ骺¸Ü«h¥u¶Ç¦^¸Ó¹êÅ餤ªºÄݩʦӤ£¥]¬A¨ä¤¤ªº¤èªk.
¦pªG°Ñ¼Æ¬OÃþ§Oªº¸Ü«h¶Ç¦^Ȥ¤¤£¥]¬A¨ä¤÷·§©À¤¤ªºÄÝ©Ê.
¹ï©ó¨ä¥L°Ñ¼Æ«h¥i¯à¶Ç¦^¤èªk©ÎÄݩʵ¥ªºÈ. |
¥yªk²§±` |
¥yªk¼g¿ù¤F |
Ãþ«¬²§±` |
°Ñ¼ÆÃþ§O¤£¹ï |
±ÀºâŪ¤J |
±ÀºâŪ¤J([´£¥Ü¥y]) -> È
¬Û·í©ó ±Àºâ(Ū¤J(´£¥Ü¥y)) / eval(raw_input(prompt)). |
¤Q¤»¶i |
¥H¤Q¤»¶iªí¥Ü |
¤j¤p¼g¤¬´« |
¥Ò.¤j¤p¼g¤¬´«() -> ¦r¦ê
¶Ç¦^©M¦r¦ê ¥Ò ¤¤©Ò¦³¦r¥Àªº¤j¤p¼g¬Û¤Ïªº¦r¦ê. |
¤j¤ÅÜ°ê¼Ð |
¤j¤½XÂন°ê¼Ð½X |
¤j¼g |
¥Ò.¤j¼g() -> ¦r¦ê
§â¦r¦ê¤¤©Ò¦³^¤å¦r¥ÀÅܬ°¤j¼g. |
¤p¼g |
¥Ò.¤p¼g() -> ¦r¦ê
§â¦r¦ê¤¤©Ò¦³^¤å¦r¥ÀÅܬ°¤p¼g. |
¤¤¤å¦r¼Æ |
¤¤¤å¦r¼Æ |
¤À¦æ |
¥Ò.¤À¦æ([«O¯d¦æ¥¼²Å]) -> ¦r¦ê§Ç¦C
¥HÂ_¦æ²Å¸¹§â¦r¦ê¤À¦¨¤@§Ç¦Cªº¤l¦r¦ê¨Ã¶Ç¦^¸Ó§Ç¦C.
¦æ¥¼ªº¤À¦æ²Å¸¹·|³Q§R¥h, °£«D¦b½Õ¥Î¥»¤èªk®Éµ¹¥X¾ã¼Æ°Ñ¼Æ «O¯d¦æ¥¼²Å
¥B¸Ó¾ã¼Æ¤Ó©ó¹s. |
¤À³Î |
¥Ò.¤À³Î([¤À³Î²Å [,³Ì¤j¼Æ¥Ø]]) -> ¦r¦ê§Ç¦C
§â¦r¦ê ¥Ò ¥H ¤À³Î²Å¬°°O¸¹¤Á¦¨¤l¦r¦ê, ¥H§Ç¦CÃþ«¬¶Ç¦^¤À³Îµ²ªG.
¦pªGµ¹¥X ³Ì¤j¼Æ¥Ø °Ñ¼ÆY¤z«h ¥Ò ³Ì¦h·|³Q¤À¦¨Y¤z¥÷¤l¦r¦ê.
¦pªG¤£«ü©w ¤À³Î²Å «h¹w³]·|¥H ªÅ®æ §@¬°¤À³Î²Å.
|
¥k¯Á¤Þ |
¥Ò.¥k¯Á¤Þ(¤l¦r¦ê [,©l[,²×]]) -> ¾ã¼Æ
©M ¥Ò.±q¥k§ä() ¤@¼Ë, ¦ý¦p§ä¤£¨ì¤l¦r¦ê·|¤Þ°_ 'Ȳ§±`' |
¥kµô |
¥Ò.¥kµô() -> ¦r¦ê
¶Ç¦^ ¥Ò ¦r¦êµô¥h¥k±ªºªÅ®æ. |
¥ªµô |
¥Ò.¥ªµô() -> ¦r¦ê
¶Ç¦^ ¥Ò ¦r¦êµô¥h¥ª±ªºªÅ®æ. |
¦X¨Ö |
¥Ò.¦X¨Ö(¦r¦ê§Ç¦C) -> ¦r¦ê
§â ¦r¦ê§Ç¦C¤¤ªº¤¸¯À¥[°_¨Ó¦¨¬°¤@Ó·s¦r¦ê. ·s¦r¦êªº¤À¹j²Å¸¹¬O ¥Ò. |
¦r¦ê½s½X |
¸ß°Ý¥Ø«e¦r¦ê½s½X |
¦rº¤j¼g |
¥Ò.¦rº¤j¼g() -> ¦r¦ê
¶Ç¦^ ¥Ò ¤¤¥u¦³º¦r¥À¬O¤j¼gªº¦r¦ê. |
¦r¼Æ |
¤¤^¤å¦r¼Æ |
¦¸¼Æ |
¥Ò.¦¸¼Æ(¤l¦r¦ê [, ©l[, ²×]]) -> ¾ã¼Æ
¶Ç¦^¦r¦ê¤¤ ¤l¦r¦ê ¥X²{ªº¤§¼Æ. ¦pµ¹¥X ©l, ²× °Ñ¼Æ«h¤ñ¸û·|¦b«ü©wªº½d³ò¤¤¶i¦æ. |
§ä |
¥Ò.§ä(¤l¦r¦ê [,©l [,²×]]) -> ¾ã¼Æ
¶Ç¦^ ¤l¦r¦ê¦b ¥Ò ¤¤º¦¸¥X²{ªº¦ì¸m.
¦pµ¹¥X ©l, ²×, °Ñ¼Æ«h·j´M·|¦b¸Ó½d³ò¤¤¶i¦æ. |
©î¦r |
¦r¦ê©î¦¨¤¤¤å©M^¤å¦r¥À |
¬O¤j¼g |
¥Ò.¬O¤j¼g() -> ¾ã¼Æ
¦p¦r¦ê¤¤¥þ¬O¤j¼g¦r¥À«h¶Ç¦^ 1, §_«h¶Ç¦^¹s. |
¬O¤p¼g |
¥Ò.¬O¤p¼g() ->¾ã¼Æ
¦p¦r¦ê¤¤¥þ¬O¤p¼g¦r«h¶Ç¦^ 1, §_«h¶Ç¦^ 0. |
¬O¦r¥À |
¥Ò.¬O¦r¥À() -> ¾ã¼Æ
¦p¦r¦ê¤¤¥þ¬O¦r¥À«h¶Ç¦^ 1, §_«h¶Ç¦^ 0. |
¬O¦r¥À©M¼Æ¦r |
¥Ò.¬O¦r¥À©M¼Æ¦r() -> ¾ã¼Æ
¦p¦r¦ê¤¤¥þ¬°¦r¥À©Î¼Æ¦r«h¶Ç¦^ 1, §_«h¶Ç¦^ 0 |
¬OªÅ®æ |
¥Ò.¬OªÅ®æ() -> ¾ã¼Æ
¦p¦r¦ê¤¤¥þ¬OªÅ®æ²Å¸¹«h¶Ç¦^ 1, §_«h¶Ç¦^ 0 |
¬O¼Æ¦r |
¥Ò.¬O¼Æ¦r() -> ¾ã¼Æ
¦p¦r¦ê¤¤¥þ¬O¼Æ¥Ø¦r«h¶Ç¦^ 1, §_«h¶Ç¦^ 0. |
¬O¼ÐÃD |
¥Ò.¬O¼ÐÃD() -> ¾ã¼Æ
¦p ¥Ò ¬O¤@¼ÐÃD¤Æªº¦r¦ê«h¶Ç¦^ 1, ¤£µM¶Ç¦^¹s.
¼ÐÃD¤Æ·N«ä¬O¨CÓ^¤å³æµüº¦r¥À³£¬O¤j¼g. |
^¤å¦r¼Æ |
^¤å¦r¼Æ |
ì©l½X |
¶Ç¦^¦r¦êªºì©l¤º®e,µ¥©ó±j³]½s½X§@¥Ø«e¤¤¤å½s½X |
®i¶}¸õ®æ |
¥Ò.®i¶}¸õ®æ([¸õ®æ¤j¤p]) -> ¦r¦ê
§â¦r¦ê¤¤©Ò¦³¸õ®æ²Å¸¹¥Î 8 ӪŮæ¨Ó¥N´À, ¨Ã¶Ç¦^µ²ªG¦r¦ê.
¦pªGµ¹¥X°Ñ¼Æ«hªí¥Ün«ü©w¸õ®æ©Ò¥NªíªºªÅ®æ¼Æ. |
¯Á¤Þ |
¥Ò.¯Á¤Þ(¤l¦r¦ê [, ©l [,²×]]) -> ¾ã¼Æ
©M ¥Ò.§ä() ¤@¼Ë¦ý¦p§ä¤£¨ì¤l¦r¦ê·|²£¥Í 'Ȳ§±`'. |
°ê¼ÐÅܤj¤ |
°ê¼Ð½XÂন¤j¤½X |
±j³]½s½X |
±j³]¦r¦ê½s½X, ¤£§@Âà´« |
±q¥k§ä |
¥Ò.±q¥k§ä(¤l¦r¦ê [,©l [,²×]]) -> ¾ã¼Æ
¶Ç¦^ ¤l¦r¦ê¦b ¥Ò ¤¤º¦¸¥X²{ªº¦ì¸m. ±q ¥Ò ªº¥k±¶}©l§ä.
¦pµ¹¥X ©l, ²×, °Ñ¼Æ«h·j´M·|¦b¸Ó½d³ò¤¤¶i¦æ. |
´À´« |
¥Ò.´À´«(¦r¦ê, ·s¦r¦ê[, ´À´«¤W]) -> ¦r¦ê
¦b¦r¦ê ¥Ò ¤¤§â©Ò¦³ ¦r¦ê ´À´«¦¨ ·s¦r¦ê.
¦pµ¹¥X ¤W «h³Ì¦h¶i¦æ¸ÓY¤z¤§ªº´À´«. |
µ²§À¬O |
¥Ò.µ²§À¬O(¦r¦ê[,©l[,²×]]) -> ¾ã¼Æ
¦p¦r¦êªºµ²§À¬O°Ñ¼Æ©Ò«ü©wªÌ¶Ç¦^ 1, §_«h¶Ç¦^ 0.
¦pµ¹¥X ©l, ²×, °Ñ¼Æ«h¦r¦ê¤ñ¸û ¥Ò ¤¤«ü©wªº¦ì¸m¶i¦æ. |
µôÃä |
¥Ò.µôÃä() -> ¦r¦ê
¶Ç¦^ ¥Ò ¦r¦êµô¥h«e«áªºªÅ®æ. |
¶}ÀY¬O |
¥Ò.¶}ÀY¬O(¦r¦ê[,©l[,²×]]) -> ¾ã¼Æ
¦p¦r¦êªº¶}ÀY¬O°Ñ¼Æ©Ò«ü©wªÌ¶Ç¦^ 1, §_«h¶Ç¦^ 0.
¦pµ¹¥X ©l, ²×, °Ñ¼Æ«h¦r¦ê¤ñ¸û ¥Ò ¤¤«ü©wªº¦ì¸m¶i¦æ. |
¸m¤¤ |
¥Ò.¸m¤¤(ªø«×) -> ¦r¦ê
¶Ç¦^ªø«×¬°°Ñ¼Æ¤¤«ü©wªº¦r¦ê, ¥Ò ¸m©ó¦r¦êªº¤¤¥¡, ¨ä¥LªÅ¦ì¶ñ¤WªÅ®æ. |
¼ÐÃD |
¥Ò.¼ÐÃD() -> ¦r¦ê
¶Ç¦^ ¥Ò ªº¼ÐÃD¤Æ¦r¦ê. ·N«ä¬O©Ò¦³^¤å³æµüªºº¦r¥À¬°¤j¼g. |
½s½X |
¥Ò.½s½X([½s½X¦WºÙ[,¿ù»~³B²z]]) -> ¦r¦ê
§â¦r¦ê ¥Ò ¤©¥H½s½X. ¹w³]ªº½s½X¦WºÙ¬O¥Ø«eªº¦r¦ê½s½X.
¿ù»~³B²z«ü©w³B²z²§±`ªº¤èªk. ¹w³]Ȭ° 'strict', ªí¥Ü½s½X¥X¿ù·|¤ÞP 'Ȳ§±`',
¨ä¥Lªº³B²z¤èªk¦³ 'ignore', 'replace'. |
½Õ¾ã½s½X |
½Õ¾ã½s½X(½s½X¦WºÙ): ¹w³]¬°¥Ø«e§YĶ¾¹ªº½s½X. |
¾a¥k |
¥Ò.¾a¥k(ªø«×) -> ¦r¦ê
¶Ç¦^ªø«×¬°°Ñ¼Æ©Ò«ü©wªº¦r¦ê, ¥Ò ©ñ¦b¦rªº¥k±, ³Ñ¾l¦ì¸m¶ñ¥HªÅ®æ. |
¾a¥ª |
¥Ò.¾a¥ª(ªø«×) -> ¦r¦ê
¶Ç¦^«ü©wªø«×ªº¦r¦ê, ¥Ò ©ñ©ó¦r¦ê¥ª±, ¨ä¾l¦ì¸m¶ñ¤WªÅ®æ. |
ÅÜ´« |
¥Ò.ÅÜ´«(ÅÜ´«ªí, [,§R°£¤l¤¸ªí]) -> ¦r¦ê
§â¦r¦ê ¥Ò ¤¤©Ò¦³¥X²{¦b §R°£¦r¤¸ªí ¤¤ªº¦r¤¸§R¥h. ³Ñ¤Uªº®Ú¾Ú ÅÜ´«ªí
¶i¦æ¬M¹ï. ÅÜ´«ªí¥²¶·¬O¤@ªø 256 ¦ì¤¸ªº¦r¦ê. |
¤Ï¦V |
§Ç.¤Ï¦V() -- §â§Ç¦C¤¤¤¸¯Àªº±Æ¦C¦¸§Ç¤Ï¹L¨Ó. ª`·N¦¹¬°§Ç¦C¤º¾Þ§@, ¦]¦¹¶Ç¦^'µL' |
¥[ªø |
§Ç.¥[ªø(§Ç¦C) -- ¦b §Ç «á±¥[¤J §Ç¦C |
¦¸¼Æ |
§Ç.¦¸¼Æ(È) -> ¾ã¼Æ -- ¶Ç¦^ §Ç ¤¤¤º®e¬° È ªº¤¸¯ÀªºÓ¼Æ |
§ä |
§Ç.§ä(È) -> ¾ã¼Æ -- ¶Ç¦^ §Ç ¤¤²Ä¤@Ó¤º®e¬° È ªº¤¸¯À¦ì¸m |
ªþ¥[ |
§Ç.ªþ¥[(¬Y) -- §â ¬Y ¥[¨ì§Ç¦C¥¼ |
®³¥X |
§Ç.®³¥X(¯Á¤Þ) -> È -- ¶Ç¦^¦ì¸m ¯Á¤Þ ¦ì¸mªº¤¸¯À¨Ã¦b §Ç ¤¤§R¥h¸Ó¤¸¯À |
±Æ§Ç |
§Ç.±Æ§Ç([¤ñ¸û¨ç¼Æ]) -- ¬°§Ç¤º¾Þ§@, ¶Ç¦^ 'µL'. ±N§Ç¦C±Æ§Ç. ¦pn¦Û©w¤ñ¤j¤pªº¨ç¼Æ, ¸Ó¨ç¼Æ©w¸qÀ³¬°: ¤ñ¸û¨ç¼Æ(¥Ò, ¤A) -> -1, 0, 1 |
²¾°£ |
§Ç.²¾°£(È) -- §R¥h §Ç ¤¤²Ä¤@Ó¤º®e¬° È ªº¤¸¯À |
´¡¤J |
§Ç.´¡¤J(¯Á¤Þ, ¬Y) -- ¦b ¯Á¤Þ ©Ò«üªº¦ì¸m«e¥[¤J ¬Y |
¤º®e |
¥Ò.¤º®e() -> ¶Ç¦^§Ç¦C¬°¦r¨å¤¤©Ò¦³±ø¥Ø¨Ã¤º®e, ¥H¤G¤¸¤¸¯À²Õªí¥Ü |
¦³ |
¥Ò.¦³(¤A) -> ¦p¦r¨å ¥Ò ¤¤¦³ ¤A ³o¤@±ø¶Ç¦^ 1, ¤£µM¶Ç¦^ 0 |
§Û¿ý |
¥Ò.§Û¿ý() -> ¶Ç¦^¦r¨åªº½Æ¥». ª`·N¦¹¬°³æ¼h½Æ»s |
§ó·s |
¥Ò.§ó·s(¤B) -> ¶Ç¦^ 'µL'. ¥Î ¤B ¨Ó§ó·s ¥Ò: ¨ú Áä ¦Û ¤B.¯Á¤Þ(): ¥Ò[Áä] = ¤B[Áä] |
¨úÈ |
¥Ò.¨úÈ(¤A[,¤þ]) -> ¦p ¥Ò ¤¤¦³ ¤A «h¶Ç¦^¸Ó¶µ¤º®e, ¤£µM¶Ç¦^ ¤þ. ¤þ¹w³]¬° 'µL' |
È |
¥Ò.È() -> ¶Ç¦^§Ç¦C¬°¦r¨å¤¤©Ò¦³ªº¤º®e |
®³¥X |
¥Ò.®³¥X() -> ¶Ç¦^¤@Ó (±ø, È), ¨Ã¦b¦r¨å¤¤§R¥h¸Ó±ø; ¦p¦r¨å¬OªÅªº«h´£¥X ÁäȲ§±` |
¯Á¤Þ |
¥Ò.¯Á¤Þ() -> ¶Ç¦^§Ç¦C¬°¦r¨å¤¤©Ò¦³±ø¥Øªº¯Á¤Þ |
²M°£ |
¥Ò.²M°£() -> ¶Ç¦^ 'µL'. §R¥h¦r¨å¤¤©Ò¦³ªº±ø¥Ø©M¤º®e |
³]È |
¥Ò.³]È(¤A[,¤þ]) -> µ¥¦P ¥Ò.¨úÈ(¤A,¤þ), ¦pªG ¥Ò[¤A] ¤£¦s¦b«h½áÈ ¥Ò[¤A]=¤þ |
¤wÃö |
¦WºÙ |
³nªÅ®æ |
¼Ò¦¡ |
¦h¦æ¿é¥X |
©w¦ì |
«á±¤£n |
¬Otty |
²M²z |
³ø¦ì¸m |
¿é¥X |
Àɸ¹ |
²Ū¦h¦æ |
Ãö³¬ |
Ū¤@¦æ |
Ū¤J |
Ū¤J¦Ü |
Ū¦h¦æ |
²§±`±µ¤f |
²§±`±µ¤f(²§±`Ãþ, È, °lÂÜ) -> µL
³B²z²§±`¨Æ¥ó, ¦b sys.¼Ð·Ç¿ù»~¿é¥X ¤¤Åã¥Ü²§±`È©M²§±`¹Lµ{°lÁa.
|
¤º«Ø¼Ò²Õ¦W |
³]°lÁa |
³]°lÁa(¨ç¼Æ)
³]©w°lÁa°£¿ù¥Îªº¥þ°ì¨ç¼Æ. ¸Ó¨ç¼Æ·|¦b¨C¦¸¨ç¼Æ½Õ¥Î«e¥ý³Q½Õ¥Î.
½Ð°Ñ¦Ò¨ç¼Æ®w¤â¥U¤¤Ãö©ó°£¿ùªº¤@¸` |
°h¥X |
°h¥X([°h¥XÈ])
²£¥Í '°h¥X¨t²Î' ²§±`ȨýեΠSystemExit(status) ¸õ¥X§YĶ¾¹.
¦pªG¤£µ¹¥X°h¥XÈ«h°h¥XȦ۰ʳ]¬° 0 (¥Nªí¦¨¥\).
¦pªG°h¥XȬO¨ä¥L¼Æ¦r«h¨t²Î°h¥X®É·|¶Ç¦^¸Ó¼Æ¦r.
¦pªG°h¥XȬO¼Æ¦r¥~ªº¨ä¥L«¬ºA«h¼g¥X¸ÓȨó]¶Ç¦^Ȭ° 1 (¥Nªí¥¢±Ñ). |
_Ū°õ¦æ®Ø |
_Ū°õ¦æ®Ø([²`]) -> ®ØÃþ§O
¶Ç¦^¦b½Õ¥Î°ï´Ì¤¤ªºÈ. ¦pªGµ¹¥X°Ñ¼Æ ²` «h¶Ç¦^°ï´Ì±q¤W¨ì¤U¸Ó¼Æ¥ØªºÈ.
¦pªG¸ÓÈn¤ñ¹ê»Úªº°ï´ÌÁÙn¤j«h·|¾ÉP 'Ȳ§±`'.
¹w³]ªº²`«×¬° 0, ªí¥Ü¥u¶Ç¦^°ï´Ì³»¼hªº°õ¦æ®Ø.
¥uÀ³¦b¨t²Î¤º³¡©Î¯S§Oªº±¡ªp¤U¤~½Õ¥Î¥»¨ç¼Æ. |
³]¥Ø«e½s½X |
³]¥Ø«e½s½X(½s½X¦WºÙ)
³]©w²Î¤@½X¦r¦ê©Ò¨Ï¥Îªº¹w³]½s½XÈ. |
ª©Åv |
°õ¦æÀÉ«eºó |
__¦WºÙ__ |
¼Ð·Ç¿é¥X |
Ū°Ñ·Ó |
Ū°Ñ·Ó(¹êÅé) -> ¾ã¼Æ
¶Ç¦^ ¹êÅé ¥Ø«e³Q°Ñ¦Òªº¦¸¼Æ.
³oӼƥإ]¬A¤F¸Ó¹êÅé§@¬°¥»¨ç¼Æªº°Ñ¼Æªº¤@ӼȮɰѦҶq, ¦]¦¹¶Ç¦^ªºÈ°_½X¬O 2. |
Åã¥Ü±µ¤f |
Åã¥Ü±µ¤f(¹êÅé) -> µL
¦b sys.¼Ð·Ç¿é¥X ¤¤Åã¥Ü¹êÅé¨Ã§â¥¦¦s¨ì __¤º«Ø__._
|
°õ¦æÀÉ |
__¼Ð·Ç¿ù»~¿é¥X__ |
Ū¥Ø«e½s½X |
Ū¥Ø«e½s½X() -> ¦r¦ê
¶Ç¦^²Î¤@½X¦r¦ê¥Ø«e©Ò¨Ï¥Îªº¹w³]¦r¦ê½s½XÈ. |
__»¡©ú__ |
¸ô®| |
¼Ò²Õ |
ª©¥»°T®§ |
³Ì¤j¾ã¼Æ |
²§±`Ãþ«¬ |
¨S³oÓÄÝ©Ê |
°Ñ¼Æ |
¦r¤¸¶¶¦ì |
³]¦P¨B¶¡¹j |
³]¦P¨B¶¡¹j(n)
³]©w¤¤Á¯§YĶ¾¹¨C¹j n Ó«ü¥O´NÀˬd¤@¦¸«D¦P¨B¨Æ¥ó.
³oÓ³]©w·|¦P®É¼vÅT½uµ{¶¡ªº¤Á´«¬¡°Ê. |
__¼Ð·Ç¿é¤J__ |
¾Þ§@¥¥x |
__²§±`±µ¤f__ |
²§±`±µ¤f(²§±`Ãþ, È, °lÂÜ) -> µL
³B²z²§±`¨Æ¥ó, ¦b sys.¼Ð·Ç¿ù»~¿é¥X ¤¤Åã¥Ü²§±`È©M²§±`¹Lµ{°lÁa.
|
Ū»¼Âk¤W |
Ū»¼Âk¤W()
¶Ç¦^»¼Âk¤Wªº¥Ø«e³]©wÈ, ´N¬O¤¤Á¯§YĶ¾¹ªº°ï´Ì¤j¤p.
³oÓÈ¥i¥Î¨ÓÁקK¹L¤jªº»¼Âk³y¦¨ C ªº°ï´Ì·¸È±q¦Ó«O¤Á¯¤£·|¦º±¼. |
¤Q¤»¶iª©¥» |
__Åã¥Ü±µ¤f__ |
Åã¥Ü±µ¤f(¹êÅé) -> µL
¦b sys.¼Ð·Ç¿é¥X ¤¤Åã¥Ü¹êÅé¨Ã§â¥¦¦s¨ì __¤º«Ø__._
|
ª©¥» |
¼Ð·Ç¿é¤J |
¤¤¤å½s½X |
«eºó |
²§±`¸ê°T |
²§±`¸ê°T() -> (²§±`Ãþ, È, °lÁa)
¶Ç¦^¥Ø«e³B²z¤¤ªº²§±`È. ¥»¨ç¼Æ¥u¯à¦b '¥¢±Ñ' «O¯d¦r¤U¨Ï¥Î.
|
¥Üĵ¿ï¶µ |
¼Ð·Ç¿ù»~¿é¥X |
³]»¼Âk¤W |
³]»¼Âk¤W(n)
³]©w¤¤Á¯§YĶ¾¹ªº°ï´Ì¤j¤p¬° n.
¦p¦¹¥iÁקK¹L¤jªº»¼Âk³y¦¨ C ªº°ï´Ì·¸È±q¦Ó«O¤Á¯¤£·|¦º±¼.
¥i³]©wªº n ªº³Ì¤jȵø¥G§Aªº¨t²Î¦Ó¤£¦P. |
³]®Ä¯àÀˬd |
³]®Ä¯àÀˬd(¨ç¼Æ)
³]©w®Ä¯àÀˬd¨ç¼Æ. ¨C¦¸¶i¦æ¨ç¼Æ½Õ¥Î«e³£·|¥ý½Õ¥Î¸Ó¨ç¼Æ.
°Ñ¦Ò¨ç¼Æ®w¤â¥U¤¤Ãö©ó®Ä¯àÀˬdªº¤@¸`. |
__¼Ð·Ç¿é¥X__ |
__»¡©ú__ |
Â_¨¥²§±` |
¤£¯à³q¹LÀËÅç |
__¦WºÙ__ |
¸ü¤J²§±` |
µLªk¸ü¤J¼Ò²Õ©Î¼Ò²Õ¦WºÙ¤£¦s¦b |
¨t²Î²§±` |
Python ¤º³¡¥X¿ù
½Ð§â³o¶µ²§±`¥H¤Î²§±`°lÂÜ©Mª©¥»,µwÅé/¾Þ§@¨t²Îµ¥
¸ê®Æ³ø§iµ¹¦³ÃöªººûÅ@¤Hû |
¬d§ä²§±` |
´M§ä²§±`ªº©³¼h·§©À |
²Î¤@½X²§±` |
©M Unicode ¦³Ãöªº²§±` |
Äݩʲ§±` |
¨S³oÓÄÝ©Ê |
°O¾ÐÅ鲧±` |
°O¾ÐÅ餣°÷¤F |
Àɮײ׵²²§±` |
¤w¶W¹L¤FÀɮקÀºÝ |
¥Î¤áĵ§i |
¥Î¤á©w¸qªºÄµ§iÃþªº©³¼h·§©À |
Ȳ§±` |
°Ñ¼ÆȪºÃþ§O¤£¹ï |
ĵ§i |
ĵ§iÃþªº©³¼h·§©À |
Áä½L¤¤Â_ |
¨Ï¥ÎªÌn¨D²×¤îµ{¦¡¹B¦æ |
·¸È²§±` |
µ²ªG¤Ó¤j¤FµLªkªí¥Ü |
²§±` |
¦¹¬°©Ò¦³²§±`Ȫº©³¼h·§©À |
¥yªk²§±` |
¥yªk¼g¿ù¤F |
¾Þ§@¨t²Î²§±` |
½Õ¥Î¾Þ§@¨t²Î¨ç¼Æ¥¢±Ñ |
¹B¦æ®Éĵ§i |
µo¥X¹B¦æ®É²§±`ĵ§iªº©³¼h·§©À |
ºâ³N²§±` |
ºâ³N²§±`ªº©³¼h·§©À |
Àô¹Ò²§±` |
¿é¤J/¿é¥XÃþ²§±`ªº©³¼h·§©À |
¤w¹L®Éªº¥Îªk |
¨Ï¥Î¤Fªº¥\¯àªºÄµ§iªº©³¼h·§©À |
¯Á¤Þ²§±` |
¯Á¤ÞȦb§Ç¦C½d³ò¥H¥~ |
¿é¤J/¥X²§±` |
©|¥¼®¹¸j |
³oÓ°Ï°ìÅܼÆÁÙ¨S¦³È |
¦WºÙ²§±` |
µLªk§ä¨ì³oÓ¦W¦r |
¥yªkĵ§i |
µo¥X¥yªk¿ù»~ĵ§iªº©³¼h·§©À |
¯BÂI²§±` |
¯BÂI¼Æ¾Þ§@¥¢±Ñ |
ÁY±Æ²§±` |
µ{¦¡ªºÁY±Æ®æ¦¡§Ë¿ù¤F |
¼Ð·Ç²§±` |
©Ò¦³¤¤Á¯¼Ð·Ç²§±`Ȫº©³¼h·§©À |
°õ¦æ²§±` |
°õ¦æ¤¤¹J¨ì·N®Æ¤£¨ìªº²§±` |
ÁäȲ§±` |
§ä¤£¨ì³oÓÁäÈ |
©|¥¼¤ä´© |
³oӥΪk©Î¦¹Ãþ¨ç¼Æ©|¥¼°µ¥X¨Ó |
Ãþ«¬²§±` |
°Ñ¼ÆÃþ§O¤£¹ï |
¸õ®æ²§±` |
ªÅ®æ©M¸õ®æ²V¦X¨Ï¥Îªº¤£·í |
°£¹s²§±` |
°£ªk©Îºâ¾l¼Æªºpºâ¤¤°£¼Æ¬°¹s |
°h¥X¨t²Î |
n¨DÂ÷¶}¤¬°Ê¼Ò¦¡ |
|