码迷,mamicode.com
首页 > 编程语言 > 详细

如何在 PyCharm 中设置 Python 代码模板

时间:2017-09-04 15:06:03      阅读:176      评论:0      收藏:0      [点我收藏+]

标签:tin   created   div   template   rip   style   第一行代码   模块   ted   

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Created by iFantastic on $DATE



if __name__ == __main__:
    pass

设置 File > Settings > File and Code Template > Python Script

使用模板时,$DATE 会自动替换为当前日期。

第一行代码,用于指定运行脚本时默认的 Python 解释器。

if __name__ == ‘__main__‘ 我们简单的理解就是: 如果模块是被直接运行的,则代码块被运行,如果模块是被导入的,则代码块不被运行

如何在 PyCharm 中设置 Python 代码模板

标签:tin   created   div   template   rip   style   第一行代码   模块   ted   

原文地址:http://www.cnblogs.com/flymeng/p/7473141.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!