# 一、Python 简介
Python 是一种解释型、面向对象、动态数据类型的高级程序设计语言。
Python 是跨平台的
# 面向对象
# 解释型语言
相对于编译型语言存在的,源代码不是直接翻译成机器语言,而是先翻译成中间代码,再由解释器对中间代码进行解释运行。比如Python/JavaScript / Perl /Shell等都是解释型语言。
解释型语言:程序不需要编译,程序在运行时才翻译成机器语言,每执 行一次都要翻译一次。
# 动态数据类型
Python是动态数据类型,变量不需要指定类型。
Python的变量,可变的是指向,不可通过变量名修改其指向数据单元的内容。
>>> x=12;
>>>
>>> y=13
>>>
>>> print 'x=',x,id(x)
x= 12 53897168
>>> print 'y=',x,id(y)
y= 12 53897144
>>> x=y
>>> print 'x=',x,id(x)
x= 13 53897144
>>> print 'y=',x,id(y)
y= 13 53897144
>>>
# 二、开发环境
官网:
Python 3.9.0下载:
在path中配置路径即可
# 三、hello world
# 四、print函数
# author: laughing
# date: 2020/11/16 10:47
# 输出字符串
print("hello world")
print('hello world')
# 输出计算表达式
print(3+5)
# 输出到文件中 (追加)
# 'a' open for writing, appending to the end of the file if it exists
fp = open("D:/python_study/test.txt","a+")
print('hello world',file=fp)
fp.close()
# 不换行输出
print("hello","world","!")
330

被折叠的 条评论
为什么被折叠?



