关于Python
1.Python 不需要将其编译成二进制码。你只需要直接从源代码 运行 该程序。在程
序内部,Python 会将源代码转换为称为字节码的中间形式,尔后再转换成你的电脑所使用的
语言,并运行它。实际上,这一流程使得 Python 更加易于使用,你不必再担心该如何编译程
序,或如何保证适当的库被正确的链接并加载等等步骤。这也同样使得 Python 程序更便携且
易于迁移。
2.通过 Python 来运行的你的程序有两种方法——使用交互式解释器提示符或直接运行一个源代
码文件。
基础
1.记住单引号括起的字符串和双引号括起的字符串是一样的——它们不存在任何区别。
2.用format()进行格式化方法:Python 中 format 方法所做的事情便是将每个参数值替换至格式所在的位置
age = 20
name = 'Swaroop'
print('{0} was {1} years old when he wrote this book'.format(name, age))
print('Why is {0} playing with that python?'.format(name))
OR
age = 20
name = 'Swaroop'
print('{} was {} years old when he wrote this book'.format(name, age))