<pre id="vvttv"><mark id="vvttv"><progress id="vvttv"></progress></mark></pre>
    <pre id="vvttv"></pre>

      <p id="vvttv"></p>

          <p id="vvttv"></p>

                <p id="vvttv"></p>

                <pre id="vvttv"><cite id="vvttv"><progress id="vvttv"></progress></cite></pre>

                  <output id="vvttv"><dfn id="vvttv"><th id="vvttv"></th></dfn></output>

                    <p id="vvttv"></p>

                    Previous Page

                    Up One Level

                    Next Page

                    Python ???

                    Contents

                    ?????1. ??θ?? ?????Python ??? Next: 3. ????????????


                    ????



                     
                    2.
                    ???Python??????

                     
                    2.1
                    ???y?????

                    ???Python?????????????????????? /usr/local/bin/python ???£??? /usr/local/bin ????????UNIX Shell ??????·????????????????????

                    python

                    ?????????????·???????????????п???????????λ???????????Python????????????????????????磬/usr/local/python?????????????????

                    ??????????????????UNIX????Ctrl+D??Windwos????Ctrl+Z????????????0?????????????????????????????????????????????????????????????????????????????import sys; sys.exit()??

                    ?????????б?????????????????Unix???????????????GNU readline ??????????????????????????????????????????????????????б??????????????????????????????????Ctrl+P????????????????????????????????????????????б?????????? A ????鵽??????????????????з?????????P??????????????????б?????????????????????????????????????

                    ?????????????Щ??Unix Shell?????????豸??????????????????????????????????????????????????????????????????????????豸???????????н????????????

                    ??????????????????????“python -c command [arg] ...?????????????????????????????????????Shell?? -c??䶮???Python?????????????????????????????????e??????????????????????

                    ???“python file??“python <file?????????????????????????????????????? input() ??raw_input()????????????????????????????????????????????????????????????????????????????β????????????????????????????????????????κ??????Python????????????????????????????????????豸??

                    ??y?????????????????н??????????????????????????????????-i????????????????????????????????????????У?????????????????????

                     
                    2.1.1
                    ????????

                    ???y????????????????????????????????sys.argv????????б????н??????????????????????????sys.argv[0]??????????????????????‘ - ’???????????????sys.argv[0]???????‘ - ’????? -c ??????sys.argv[0]???趨?‘ -c ’?? -c ??????????????? Python ?????????????????????????????sys.argv ?У???????????????

                     
                    2.1.2
                    ??????

                    ??tty???????????????????????????????????????????????????????????У?????????????????????????“>>> ”????????????????????????????????????????“... ????????????????????????????????汾???????????

                    python
                    Python 2.3 (#1, Jul 30 2003, 23:22:59)
                    [GCC 3.2 20020927 (prerelease)] on cygwin
                    Type "help", "copyright", "credits" or "license" for more information.
                    >>>

                    ??????н????????????????????磬??????? if ???

                    >>> the_world_is_flat = 1
                    >>> if the_world_is_flat:
                    ...     print "Be careful not to fall off!"
                    ... 
                    Be careful not to fall off!

                     
                    2.2
                    ?????????價??

                     
                    2.2.1
                    ??????

                    ?д?????????????????????????????????????????????????????£??????????????????????????????У??????????????????????????????????????try????е?except???????????????????????????е????????? ???Щ??????????????·????????????????????????ì???????????ɡ????е?????????д????????????????????е???????д?????????

                    ???????????????????????ж?????????Control-C or DEL?????????????????????????С?2.1????????????????ж?????????? KeyboardInterrupt ???????????try?????

                     
                    2.2.2
                    ???Python???

                    BSD???У?Python?????????Shell????????????У?????????????д???????????????????

                    #! /usr/bin/env python

                    (?????·??????????) “#!”????????????????????????Щ?????????б?????Unix?????н???????“\n??????????????Mac??“\r????Windows??“\r\n??????????????“#”??Python?????????????????

                    ?????????? chmod ????????????????????

                    $ chmod +x myscript.py

                    2.2.3 ????????

                    Python???????????????????? ASCII ???????????? ???????????? #! ?к???????????????????????????????

                    # -*- coding: iso-8859-1 -*-

                    ?????????????Python??????е??????????????????????Unicode????????У??????????? iso-8859-1 ???? Python ??ο???? ?п???????????????б???????????飬????????????cp-936??utf-8??????????GB??GBK??GB-18030??ISO-10646?????????????

                    ????????????????UTF-8???????????????UTF-8????aka BOM - Byte Order Mark?????????????????????????????????????Jext?????????????????Vim??????????????????????????????????????????????????????????????????????IDLE????????趨Options/General/Default Source Encoding/UTF-8 ????????????????????Python????????????Python 2.2??????汾??????????????????????#!?????

                    ???UTF-8?????????????????????????????????????????????????????????????????????????в?????÷? ASCII ???????????????????е??????????????????н?????????UTF-8?????????????????????????????????塣

                     
                    2.2.4
                    ?????????????????

                    ???Python?????????????????????????ν?????????????Щ???䶮??????????????а??????????е??????趨??????PYTHONSTARTUP ??????????????????????????????Unix shell??.profile?????

                    ?????????????????????????Python?????н?????????????????????????????????????????????????????????????????????????е??????????????????????????????????????п???????????в??????????á?????????????????и??sys.ps1??sys.ps2??䶮

                    ??????????????????и?????????????????????????????м??????????μ????“if os.path.isfile('.pythonrc.py'): execfile('.pythonrc.py')”?? ????????????????????????????????????????д???????????

                    import os
                    filename = os.environ.get('PYTHONSTARTUP')
                    if filename and os.path.isfile(filename):
                        execfile(filename)



                    ???

                    ... ???2.1
                    GNU readline???????????????????????????????

                    Previous Page

                    Up One Level

                    Next Page

                    Python ???

                    Contents

                    ?????1. ??θ?? ?????Python ??? Next: 3. ????????????


                    Release 2.3, documentation updated on July 29, 2003.

                    See About this document... for information on suggesting changes.
                    ?????, @ssv

                      <pre id="vvttv"><mark id="vvttv"><progress id="vvttv"></progress></mark></pre>
                      <pre id="vvttv"></pre>

                        <p id="vvttv"></p>

                            <p id="vvttv"></p>

                                  <p id="vvttv"></p>

                                  <pre id="vvttv"><cite id="vvttv"><progress id="vvttv"></progress></cite></pre>

                                    <output id="vvttv"><dfn id="vvttv"><th id="vvttv"></th></dfn></output>

                                      <p id="vvttv"></p>

                                      这里只有精品视频