- 浏览: 123865 次
- 性别:
- 来自: 武汉
-
文章分类
最新评论
<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. #
##########################################################################
发表评论
-
一个完整的php项目示例
2009-05-19 13:30 1325<script>function StorePag ... -
一个简单的python代理服务器源码分析
2009-05-20 00:29 1442<script>function StorePag ... -
python起步
2009-05-21 00:15 618<script>function StorePag ... -
urllister.py源码分析
2009-05-22 00:08 1081<script>function StorePag ... -
fibonacci.py源代码分析
2009-05-22 23:24 634<script>function StorePag ... -
builddialectexamples.py源代码分析
2009-05-25 00:05 542<script>function StorePag ... -
piglatin.php源代码分析
2009-05-25 22:58 708<script>function StorePag ... -
plural.py源代码分析
2009-05-26 22:28 586<script>function StorePag ... -
regression.py源代码分析
2009-05-27 21:33 809<script>function StorePag ... -
apihelpertest.py源代码分析
2009-05-28 23:47 543<script>function StorePag ... -
argecho.py源代码分析
2009-05-30 00:44 633<script>function StorePag ... -
soundex.py源代码分析
2009-05-31 01:58 567<script>function StorePag ... -
plural1.py源代码分析
2009-05-31 22:27 617<script>function StorePag ... -
toolbox.py源代码分析
2009-06-01 23:00 577<script>function StorePag ... -
sum.py源代码分析
2009-06-03 00:14 800<script>function StorePag ... -
stringFormatting.py源代码分析
2009-06-04 23:49 512<script>function StorePag ... -
operator.py源代码分析
2009-06-05 23:12 584<script>function StorePag ... -
average.py源代码分析
2009-06-07 00:20 527<script>function StorePag ... -
square.py源代码分析
2009-06-08 00:05 630<script>function StorePag ... -
left.php源代码分析
2009-06-09 01:06 987<script>function StorePag ...
相关推荐
### Python中的标识符和保留字 #### 一、引言 在编程语言中,标识符与保留字(关键字)是两个基本且重要的概念。对于初学者来说,掌握这些概念能够帮助他们更顺利地进行编程实践;对于有经验的开发者而言,则能够...
下面是一些关于Python变量使用的要点: 1. 变量赋值:使用 `=` 运算符将值赋给变量。 2. 动态类型:Python是动态类型语言,变量的数据类型可以根据赋值改变。 3. 命名规则:遵循标识符规则,避免与内置函数和保留字...
在学习Python编程语言的过程中,理解变量和数据类型是至关重要的基础知识点。变量是存储数据的容器,程序通过变量名来引用这些数据。Python作为一门动态类型语言,允许变量在不声明数据类型的情况下被创建和赋值。...
### Python 变量与数据类型详解 #### 一、变量 **1.1 什么是变量** ...以上内容概述了 Python 中关于变量和数据类型的初级知识,通过理解这些概念,可以为后续学习更复杂的编程技巧奠定坚实的基础。
理解Python的标识符和变量的概念是学习Python编程的基础。它们帮助我们组织和操作数据,是编写任何Python程序不可或缺的部分。通过熟练掌握这些基本概念,你将能够更有效地编写出高效且易于维护的代码。
在后续的例子中,x、y和z变量的值和类型都可以发生变化,但这种变化是通过重新赋值实现的。 第三部分,Python的数据类型不需要指定类型声明。在Python中,变量的类型是在运行时自动确定的,称为动态类型。这意味着...
Python语言简介、特点、标识符、变量类型
变量可以理解为去超市购物的菜篮子,它们的类型和值在赋值的那一刻被初始化。Python 中的变量不需要声明,直接使用。 标识符是 Python 中的一种符号,用于表示变量名、方法名、类名等。标识符由字母、下划线开头,...
根据提供的PPT概要内容,我们可以总结出关于Python的基础知识点,包括注释、变量与基本数据类型等内容。下面是这些知识点的详细阐述: ### 注释 #### 注释的重要性 注释在编程中非常重要,它们帮助程序员理解代码的...
变量是程序中用来存储和表示值的标识符。在Python中,你可以直接赋值给变量,无需提前声明变量类型。例如,`name = 'John Doe'` 创建了一个名为`name`的变量,其值为字符串`'John Doe'`。变量可以用来保存任何类型的...
### Python变量知识点详解 #### 变量概述 变量在Python编程中扮演着极其重要的角色,它们是用于存储数据值的标识符。理解变量的概念、命名规则以及如何使用它们对于掌握Python编程至关重要。 #### 注释 - **作用**...
【Python变量】 变量是存储数据的容器,它们可以用来保存各种类型的值,如数字、字符串或列表。在Python中,变量的创建和赋值非常简单,只需要给标识符赋值即可。例如: ```python age = 25 # 创建一个整数变量 ...
Python语法和动态类型,以及解释型语言的本质,使它成为多数平台上写脚本和快速开发应用的编程语言,随着版本的不断更新和语言新功能的添加,逐渐被人们用于独立的、大型项目的开发和设计 Python解释器易于扩展,...
在Python中,变量是用来存储值的标识符,你可以把它想象成一个标签,它指向内存中的特定位置,那里存储着实际的数据。创建变量非常简单,只需要给变量命名并赋值即可。例如: ```python name = "张三" age = 25 is_...
以下是关于Python变量及数据类型用法原理的详细说明: 1. **变量(Variable)**: - 变量可以被视为存储数据的容器,它们的值可以在程序执行过程中改变。 - 在Python中,创建变量只需赋值,例如`name = "Alice"`...
python基础知识--关键字,标识符,输入输出,变量,数据类型,条件控制
在Python中,标识符是变量、函数、类等的名称。它们遵循以下规则: - 必须以字母或下划线开头。 - 非首字符可以是字母、下划线或数字。 - 区分大小写。 - 不能使用Python的保留关键字,如`if`、`for`等。 命名约定...
在深入理解Python变量之前,我们先要明白什么是变量。在Python中,变量严格来说被称为“名字”,也可以比喻为标签。当你给一个值赋予一个名字,就像是给一个盒子贴上了标签。例如,如果有一个字符串"学会Python还...
本章节主要介绍Python中的数据类型和基本运算,涵盖了标识符、保留字、变量的定义和赋值等内容。 2.1 标识符和保留字 在Python中,标识符是用于命名变量、函数、类、模块等对象的名称。标识符由字符(A~Z和a~z)、...
掌握变量和数据类型是Python编程的基石,通过不断的练习和实际应用,你可以更加熟练地运用这些知识解决各种问题。记得,编程不仅仅是理论学习,实践是提升技能的关键。所以,动手尝试编写代码,体验Python的魅力吧!