<span id="7ztzv"></span>
<sub id="7ztzv"></sub>

<span id="7ztzv"></span><form id="7ztzv"></form>

<span id="7ztzv"></span>

        <address id="7ztzv"></address>

            ???? Python ???
            ??9?? ?????
            ???? ??? ????

            ???

            ?????§Ò???????????????????????????? ?????? ???????????î•???????????????????????????‰^?????????????????????????????????????????????????????????????????

            ??????

            ??9.2 ??????

            #!/usr/bin/python
            # Filename: using_tuple.py


            zoo = ('wolf', 'elephant', 'penguin')
            print 'Number of animals in the zoo is', len(zoo)

            new_zoo = ('monkey', 'dolphin', zoo)
            print 'Number of animals in the new zoo is', len(new_zoo)
            print 'All animals in new zoo are', new_zoo
            print 'Animals brought from old zoo are', new_zoo[2]
            print 'Last animal brought from old zoo is', new_zoo[2][2]

            ????????code/using_tuple.py??

            ???

            $ python using_tuple.py
            Number of animals in the zoo is 3
            Number of animals in the new zoo is 3
            All animals in new zoo are ('monkey', 'dolphin', ('wolf', 'elephant', 'penguin'))
            Animals brought from old zoo are ('wolf', 'elephant', 'penguin')
            Last animal brought from old zoo is penguin

            ????¦É???

            ????zoo???????ï…???????len?????????????????????????????????????????????

            ????????????????????????????????????????new_zoo?????????§»???????????????????????????????????????????????????õ™????????????

            ???????????????????????????????¦Ë??????????????§Ö????????????????§Ò???¡Â???????????? ???? ??????????????new_zoo[2]??????new_zoo?§Ö??????????????????new_zoo[2][2]??????new_zoo????????????????????????

            ????0????1?????????î•???????????????????????????myempty = ()??????????§Ö?????????????????????????????????¦·????????????????????????Python???????????????????????????????????????????????????????2?????????????????singleton = (2 , )??

            ??Perl??????????
            ?§Ò???§Ö??§Ò?????????????????§Ò??????Perl????????????????????§Ö???ï…???§Ò??§Ö???ï…??????§Ö??§Ò??????????????Python??????????????????????›¥?????

            ??????????

            ???????????¡Â?????????????§µ???????????????

            ??9.3 ?????????

            #!/usr/bin/python
            # Filename: print_tuple.py


            age = 22
            name = 'Swaroop'

            print '%s is %d years old' % (name, age)
            print 'Why is %s playing with that python?' % name

            ????????code/print_tuple.py??

            ???

            $ python print_tuple.py
            Swaroop is 22 years old
            Why is Swaroop playing with that python?

            ????¦É???

            print????????????%?????????????????????§»???????????????????????????????????????????????????%s??????????%d????????????????????????????????§»?????

            ?????????????????ï…???????????%s??????????name??????????§Ö???????????????????????%d??????????????????age??

            Python???????????????????§Ö????????????????????????????????�I?????¦Ë?¨¢????%s???�I?????name??????????????

            print??????¡Â?????§Õ?????¨¹???????????????????????????????????????????????????????

            ??????????????????%s?????????Python???????????????î•????????????????§¹????????????????????????????????????????????????????????

            ??????print????§µ?????????????????????????%?????????????????????????????????????????????????????§¹??


            ???? ????? ????
            ?§Ò? ??? ???
            ?????
            @ssv
            <span id="7ztzv"></span>
            <sub id="7ztzv"></sub>

            <span id="7ztzv"></span><form id="7ztzv"></form>

            <span id="7ztzv"></span>

                  <address id="7ztzv"></address>

                      ÑÇÖÞÅ·ÃÀÔÚÏß