Python基础学习

Pycharm的简单使用及快捷键介绍

阅读目录

  • Pycharm的简单使用

  • 变量

  • 注释

  • Python库———turtle的简单使用


目录

Pycharm的简单使用

个性化设置

  1. file --》 settings --》 editor --》general --》 change font size

  2. file --》 settings --》 editor --》font --》 修改默认字体大小

  3. file --》 settings --》 editor --》color Scheme --》 python --》monokai (主题的配置)

  4. file --》 settings --》 editor --》 general --》 code completion --》case sensitive completion --》 None

组合键的使用

  • ctrl+v 粘贴

  • ctrl+c 复制

  • ctrl + a 全选

  • ctrl + x 剪切(默认剪切整行)

  • ctrl + y 删除整行

  • ctrl + del 删除一个单词

  • shift + enter 换行

  • ctrl + f 搜索—》math case 匹配大小写;words 匹配单词(空格区分单词)

  • ctrl + d 向下复制

  • ctrl + shift + r 全局搜索

  • shift + f10 运行上一次运行的文件

  • ctrl + shift +f10 运行当前文件

  • home 行首

  • ctrl + home 文件首部

  • end 行尾

  • ctrl + end 文件尾部

回到顶部

变量

什么是变量

变化的量(状态--》描述某件事物的属性)

定义变量

变量名 赋值符号(=)变量值

描述(接收变量值) 赋值符号 具体的值

变量的规则

  1. 变量名必须具有意义

  2. 变量名以字母/数字/下划线_组成,不能数字开头

  3. 不能以关键字命名

变量名的两种方式

变量名的两种方式
#下划线和驼峰体
age_of_lz = 18#下划线分割单词
ageOfLz = 18#尽量不使用

注释


#注释
#1.让后面的代码失效,解释器不解释,就是普通字符
# 2.解释前面的代码
'''
三单引号多行注释
'''

Python库———turtle的简单使用

相关python代码

import turtle
#忘了加注释。。
turtle.setup(850, 400)
turtle.pencolor('black')
turtle.penup()
turtle.goto(425,200)
turtle.pendown()
turtle.fillcolor('yellow')
turtle.begin_fill()
turtle.fd(-800)
turtle.seth(90)
turtle.fd(-400)
turtle.seth(0)
turtle.fd(800)
turtle.seth(90)
turtle.fd(400)
turtle.end_fill()
turtle.penup()
turtle.fd(-100)
turtle.seth(-180)
turtle.fd(150)
turtle.pendown()
turtle.fillcolor('black')
turtle.begin_fill()
turtle.circle(35,360)
turtle.end_fill()
turtle.penup()
turtle.seth(90)
turtle.fd(-45)
turtle.pendown()
turtle.fillcolor('white')
turtle.begin_fill()
turtle.circle(15,360)
turtle.end_fill()
turtle.penup()
turtle.fd(45)
turtle.seth(180)
turtle.fd(500)
turtle.pendown()
turtle.fillcolor('black')
turtle.begin_fill()
turtle.circle(35,360)
turtle.end_fill()
turtle.penup()
turtle.seth(90)
turtle.fd(-45)
turtle.pendown()
turtle.fillcolor('white')
turtle.begin_fill()
turtle.circle(15,360)
turtle.end_fill()
turtle.penup()
turtle.fd(-30)
turtle.seth(-180)
turtle.fd(80)
turtle.pendown()
turtle.fillcolor('red')
turtle.begin_fill()
turtle.circle(45,360)
turtle.end_fill()
turtle.penup()
turtle.fd(-730)
turtle.seth(-180)
turtle.fd(80)
turtle.pendown()
turtle.fillcolor('red')
turtle.begin_fill()
turtle.circle(45,360)
turtle.end_fill()
turtle.penup()
turtle.goto(40,0)
turtle.pendown()
turtle.pencolor('black')
turtle.pensize(3)
turtle.seth(-8)
turtle.fd(100)
turtle.circle(4,120)
turtle.penup()
turtle.goto(40,0)
turtle.pendown()
turtle.pencolor('black')
turtle.pensize(3)
turtle.seth(-166)
turtle.fd(110)
turtle.circle(-4,120)
turtle.penup()
turtle.goto(40,0)
turtle.pendown()
turtle.fillcolor('red')
turtle.begin_fill()
turtle.seth(-8)
turtle.fd(90)
turtle.seth(75)
turtle.fd(-135)
turtle.circle(55,-140)
turtle.fd(-135)
turtle.end_fill()
turtle.done()


 

 

 

原文地址:https://www.cnblogs.com/lyyblog0715/p/11402323.html