Python初识
1.python可以做什么
- 系统编程
- 用户图形借口
- Internet脚本
- 数值计算和科学计算编程
- 游戏, 图像, 人工智能, XML, 机器人
2.Python的运行
- 交互提示模式下编写:实验和测试
系统命令行和文件:
python script1.py >msg.txt 流重定向win10中设置默认打开程序为 python.exe:
input阻塞执行 .py文件,可以看见输出结果
3.模块导入和重载
- import 和 from … import …
myfile.py中有如下内容:title=’The Meaning of Life’
import myfile
print(myfile.title)
>>>The Meaning of Life
from myfile import title
print(title)
>>>The Meaning of Life
- exec运行模块文件:exec(open(‘myfile.py’).read())
4.IDLE用户界面
初学者最好用这个写程序,简单易用
想熟悉Python基本语言知识可以点击这里:
Python基本语法练习
- -