<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>

                      ŷ