python打印变量的标识符、类型和值

<script>function StorePage(){d=document;t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');void(keyit=window.open('http://www.365key.com/storeit.aspx?t='+escape(d.title)+'&u='+escape(d.location.href)+'&c='+escape(t),'keyit','scrollbars=no,width=475,height=575,left=75,top=20,status=no,resizable=yes'));keyit.focus();}</script># Fig. 2.13: fig02_13.py # Displaying an object's location, type and value. # prompt the user for input integer1 = raw_input( "Enter first integer:\n" ) # read a string print "integer1: ", id( integer1 ), type( integer1 ), integer1 #打印integer1的标识符、类型和值 integer1 = int( integer1 ) # convert the string to an integer print "integer1: ", id( integer1 ), type( integer1 ), integer1 #打印integer1的标识符、类型和值 integer2 = raw_input( "Enter second integer:\n" ) # read a string print "integer2: ", id( integer2 ), type( integer2 ), integer2 #打印integer2的标识符、类型和值 integer2 = int( integer2 ) # convert the string to an integer print "integer2: ", id( integer2 ), type( integer2 ), integer2 #打印integer1的标识符、类型和值 sum = integer1 + integer2 # assignment of sum print "sum: ", id( sum ), type( sum ), sum #打印sum的标识符、类型和值 ########################################################################## # (C) Copyright 2002 by Deitel & Associates, Inc. and Prentice Hall. # # All Rights Reserved. # # # # DISCLAIMER: The authors and publisher of this book have used their # # best efforts in preparing the book. These efforts include the # # development, research, and testing of the theories and programs # # to determine their effectiveness. The authors and publisher make # # no warranty of any kind, expressed or implied, with regard to these # # programs or to the documentation contained in these books. The authors # # and publisher shall not be liable in any event for incidental or # # consequential damages in connection with, or arising out of, the # # furnishing, performance, or use of these programs. # ##########################################################################
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值