2021年,python的入门基础-----基础一

先记录下pycharm编译器相关的信息

1、某些常用快捷键:

Ctrl+/ 注释;

Tab缩进,shift+Tab;

Ctrl+Z 撤销

2、设置界面编辑风格:

File>Settings>Editor>CodeStyle>Python

python 基础

 

3、print 提一下格式化输出:

print ("%s is %d year old "%('lio',18))
》》lio is 18 year old

4、input 输入:

cmd = input("input your want to run cmd:")
print(cmd)

 

 5、注释:

 

#号当行注释

注释快捷键:ctrl+/

取消注释也是:ctrl+/

多行注释:''' 多行注释哦''',  单引号和多引号可以通用,也可以选中多行ctrl+/

6、 缩进:缩进是4个空格键

快捷键:Tab

取消缩进:shit+Tab

7、脚本的命名规范:

 》 脚本的命名最好以;字母、数字、_(下划线)组成(字母开头),

》脚本的命名不要与pthon模块、函数名重复,例如:pip

》不要有中文、空格、特殊字符,规范命名

8、编码声明:

》在第一行 # 开头

》固定格式,除了#后有一个空格,其他地方不要有空格

》只有一下3种固定格式:

# coding:utf-8
# coding=utf-8
# -*-coding:utf-8-*-

 

posted @ 2021-01-04 15:17  wellons  阅读(73)  评论(0编辑  收藏  举报