首页 > 编程语言 >python教程修订版

python教程修订版

时间:2024-09-27 11:48:16浏览次数:3  
标签:going 教程 just re python here Python 修订版 So

9/23

In this course, I'm going to teach you everything you need to know to get started programming in Python.

Now, Python is one of the most popular programming languages out there在众多的……中.

And it's by far目前为止 one of the most sõught after受欢迎的 for jobs.

And so if you're trying to get a job or you're trying to ãutömāte自动化 your life or you're trying to write awesome scripts to do a bunch of一堆 different things, then Python's for you.

Honestly, more and more developers every day are moving their projects over to Python because it's such a powerful and it's such an easy to use language.

A lot of programming languages out there just aren't very beginner friendly.

There's a lot of sỳntax.

There's a lot of like little things that if you get wrong, the program will yell at you.

Python is the complete opposite of that.

You basically just type out what you want to do and Python does it.

It's that simple.

There's not a whole lot of大量的 syntax to learn.

The learning cûrve曲线 is litërälly字面意义的 zero.

You jump in, you can start writing your first program in seconds.

In this course, I'm going to teach you guys everything you need to know to get started in Python.

I designed this course, especially for Python.

And each lesson has been specially designed with examples that will help you along the way.

with so many people starting to learn Python.

The question isn't why should you learn Python? The question is, why shouldn't you?

And I think for a lot of people the reason they might not want to learn Python is because they're intimidāted害怕担心 or they're afraid that it's going to be too hard.

Trust me, I am going to hold your hand through this èntīre全部的 course.

We're going to talk about all the cõre concepts核心概念 in Python.

We're going to look at everything you need to know to start programming in Python and start being confïdënt自信的 and start writing scripts and start writing programs that are awesome and doing cool things in your life.

Anyway, I'm super pûmped to迫不及待 be teaching you guys Python.

I can't wait to get started in this course.

And I hope you guys stick around逗留 and follow along with the course and learn this amazing programming language.

In this tūtõríäl教程, I'm going to show you guys how to install Python onto your computer.

And we're also going to install a text editör文本编辑器 that we can use to write our Python programs in.

So the first order of business首要任务 is to actually install Python on your computer.

So what we want to do is head over前往 to our web browsër浏览器.

And you want to go over here to this page, it's just www.python.org forward slash正斜杠/ downloads.

And on this page, there's going to be two buttons down here.

And it's just going to say download Python 3.6.3.

And at least that's the version that I have right now.

or download Python 2.7.1.4.

So here's the thing about Python, there's actually two mājör主要的 versions of Python that are in use cûrrëntly目前.

There's Python two, and there's Python three.

So you can see over here, this is like 2.7.1.4.

Basically, any Python two version we would just refer to as like Python two.

And here's like the latest Python three version.

And so there's these two versions that you can download.

And the first thing we have to decide is which version do we want to download.

9/24

And here's the basic difference:  
Python two is a legäcy遗留 version of Python,  
which basically means that it's like an old version,  
and it's not being like actively积极 maintained维护 or süppõrted提供帮助 like öfficiälly官方的,正式的 by Python anymore.  
Python three is like the future of Python.  
It's like the newest version.  
It's the one that's getting actively maintained and supported.  
And so there's prōs优点 and cõns缺点 to picking either one.  
A lot of people will say like Python two has been around longer.  
And so there's more like libraries,  
there's basically just more Python code written in Python two.  
So therefore, like there's a few more things that you can do in Python two than you can do in Python three.  
But then again另一方面, Python two is not supported.  
And you know, five or 10 years from now, probably no one's going to be using it.  
Python three, like I said, is like the future of Python.  
It's the newest version.  
It's the one that, you know, is sort of有点算是 being maintained going forward今后.  
So for the pürpöses of 为了this tutorial, I'm going to be teaching you guys Python three.  
So we're going to want to download Python three.  
Now here's the thin·g, like, if you learn Python three or you learn Python two, the differences aren't very big.  
There are a few differences in like some syntax and just some, you know, little things here and there.  
But if you learn Python three, you'll be able to jump right in and code in Python two as well.  
Don't let anyone, you know, tell you that you have to learn one or the other;  
we're going to learn Python three just because it's I think probably the best for a beginner to learn.  
And so that's the one that we want to download.  
So I'm just going to click点击 download Python three.  
And we're going to go ahead and download this version.  
And when that's done downloading, I'm just going to head down to my downloads fōldër文件夹.  
And you'll see here, we just have this file,  
I'm just going to double click.  
And we get this like Python installer.  
So I'm just going to click through here.  
And we'll be able to install Python three on our computer.  
All right, when that's done installing, we can just close out of this,  
and we should be good to go准备好了.  
So now we have Python three installed on our computer.  
The next step is we need to choose a text editor.  
So we're going to be writing a bunch of code.  
So we're going to need some, you know, ènvīrönmënt环境 or some program that we can write all that code in.  
And really, you can write Python in any text editor;  
you could write it in like notepad or text edit, it doesn't really matter.  
But there are special text editors that are designed just for writing Python code.  
And these are called IDEs.  
And that stands for...的缩写 intègrāted集成的 development environment.集成开发环境  
It's basically just a special environment where we can, you know, run and exècúte执行 our Python code.  
And it'll, you know, basically like tell us how we're doing.  
So if we're, you know, if we write something that's wrong or we have errors,  
it'll kind of point us in the right dïrection方向、指引 of what we need to do to fix that stuff.  
So in this course, we're going to be using an IDE.  
And one of my favorites, and one of the most popular IDEs for Python, is called pychårm.  
So I'm over here on this website, it's called https://www.jetbrains.com/pycharm/.  
And this is the IDE that we're going to be using in this course.  
So I'm just going to come over here and click this big download now button.  
And we'll go ahead and download this pycharm program.  
Alright, so I'm getting this page over here.  
You can see there's two versions of pycharm.  
One is a pröfessiönäl专业 version, and that one's like paid, so you have to pay for it.  
But then there's this cömmúnity社区 version down here, and that's free and open sõurce资源.  
So I'm just going to download this one.  
And this should have everything we need to get started using Python.  
Alright, when that finishes downloading, I'm just going to pull that up 打开in my downloads folder.  
And again, we can just sort of run this guy.  
And I'm on a Mac.  
So I'm going to have to drag拖 it over to my applications folder.  
Alright, so we now have pycharm.  
And we have Python three installed on our computer.  
So we're ready to start programming in Python.  
And this tutorial, we're going to create our first Python program.  
And we're going to be able to run it and see how everything works.  
The first thing I want to do is open up pycharm.  
So pycharm was the IDE, the integrated development environment that we downloaded in the last tutorial.  
So I'm just going to go ahead and search for it on my computer.  
And I can just open it up.  
And when we first open up pycharm, we should basically just get a window prompting引导 us to create a project.  
So you can see that down here.  
Actually, the first thing I want to do though is come over here to cönfig[y]üre.  
And I'm just going to click on preferënces偏好.  
And I actually want to change the äppēaränce外观.  
So I'm going to go ahead and give this a thēme主题.  
So I just went over here to appearance and bèhāvíör行为, appearance.  
And I'm going to change the theme to dark.  
Just because I think it's a little bit easier to use and look at.  
But you don't have to do that if you don't want to.  
And so down here, I'm just going to click create new project.  
And it's going to give us this little window right here.  
So I can just name my project.  
And I'm just going to name this draft草稿.  
And then there's this other option选项 down here where it says intërprètër解释器.  
Now, what we want to select is Python version three.  
So if I click down here, you'll notice that there's a couple different options.  
So I'm on a Mac computer.  
And by dèfãult默认, Mac has Python version two installed on it.  
If you're on a Windows mächine机器, I'm not sure if it does.  
But in this tutorial, we're going to be using Python three.  
So you want to make sure that you have Python three selected as the interpreter.  
Other-wise否则, you might not be able to fully follow along with what we're doing in this video.  
So now I'm just going to come down here and click create.  
And this is going to go ahead and create our project for us.  
All right, so now we have our Python project up and running.  
And I want to show you guys how we can create our first Python program.  
So over here in this draft folder, and this is just that project that we created,  
I'm just going to right-click and I'm going to say new.  
And I'm going to come down and click Python file.  
So we want to create a new Python file; this will be our first Python program.  
And I can just give this a name.  
So why don't we just call this app?  
And I'm just going to click okay.  
All right, so now we have our first Python file open.  
And we can just start typing in some Python.  
So I want to show you guys just a very basic Python program.  
And this is just going to be a hello world program.  
So we're just going to print something out onto the scrēen屏幕.  
So what I want to do is I want to type out print.  
And I want to type in open and closed pärenthësēs园括号.  
Now inside of this parentheses, we can make some quōtātion引用 marks.  
And inside of the quotation marks, I'm just going to type out hello world.  
So this is like a very basic Python program.  
And what this is going to do is it's just going to print out hello world onto the screen.  
And so now what I can do is I can actually run this file,  
and we're actually getting a little error here.  
It wants us to create a new line at the end of the file.  
And so now, in order to为了 run our Python program,  
I'm just going to come up here to the top.  
And I'm just going to click run.  
And we'll click this run button right here.  
And now we'll see what happens.  
So it's asking me what I want to run.  
I can just click app.  
And down here at the bottom, you'll notice that...,  
that just got printed out, hello world.  
And so whatever任何 I print, or whatever I put inside of this print stātëmënt指令,  
is going to get printed out down below in the cönsole控制台.  
So as long as只要 you're getting that print statement to work,  
then you've actually written your first Python program.  
And as we go through forward 继续in the course,  we're going to be writing all sorts of awesome Python programs.  
And we're going to be doing all sorts of cool stuff. In this tutorial, I want to talk to you about writing a basic Python program.  
So we're going to write just a very simple Python program.  
We're going to look at how we can go ahead and write our programs,  
we're going to talk about how our programs are getting executed by Python.  
And we're also going to drãw画 out a little shape形状 onto the screen.  
So this is going to be pretty cool.  
I'm excited to talk to you guys about just the báre basics最基本 of Python,  
and really just sort of give you an intrödûction介绍.  
So over here, we have our basic text editor.  
And so any of the Python code that I write inside of this file  
is actually going to get executed by Python.  
So this Python file has a bunch of Python code inside of it.  
And basically what we're doing when we're programming in Python  
is we're just giving the computer a set of一组 instrûctions命令.  
Right, that's really what programming is;  
it's just like we're specifýing指定 a set of instructions.  
And the computer is going to go off运行 and execute those instructions that we give it.  
And so the more complex复杂 the instructions we give to the computer,  
the more complex the tasks任务 the computer can carry out.  
So I want to show you guys how we can use some Python instructions  
or some Python code in order to draw out a shape onto the screen.  
So I'm actually going to draw out a little trīangle三角形.  
So over here, we can actually print something out onto the screen in Python  
using something called print statements.  
So I can just type out print.  
And inside of these parentheses, I can just type some quotation marks,  
and inside the quotation marks, we can put whatever we want to print out onto the screen.  
So I'm going to copy this and I'm actually going to make a few of these little print statements.  
And we're going to actually draw a shape.  
So we're going to draw like a triangle type shape.  
So down here, I'm just going to draw a forward slash.  
And then up here, I'll make a space空格 and we'll do another forward slash.  
Here, we'll make two spaces, we'll do another forward slash.  
And over here, we're going to make three spaces and a forward slash.  
And now I'm going to draw like vërticäl垂直 bars going all the way down.

9/25

And actually we can do some under-scõres下划线here as well. That'd be kind of cool.

All right so now we have our triangle looking shape and you can see it looks kind of like a right triangle.

So I can save my file. And I can either come up here to run and click run app. Or if you're using PyCharm you can also just come over here and click this play button.

And when I click the play button I want you to notice what happens down here.

So down here we have this little window and this is called the console.

And basically the console is just a place where Python is going to output some information.

So when we use this print statement we're basically telling Python like, Hey, can you print something out onto the console?

So there's a lot of situations where we're going to want to see what's going on in our code.

And we can use that print statement and print things out to the console. And we can basically like have a little window into what our program is doing.

In our case, we're just going to be printing out this triangle onto the console.

So I'm going to come over here and click this play button. And you'll see down here, we're actually printing out that triangle.

So mission任务 äccömplished完成, we were able to print out our shape. So I could really draw any shape I wanted as long as I was able to specify it inside of these print statements.

So èssentiälly本质上, what Python's doing when I click that play button is it's going into this file and it's looking at all of these instructions in order.

So the first thing it does is it goes to this instruction, and it says okay, they want me to draw out these like little forward slash in this vertical bar onto the screen.

Once it does that, it goes down to this instruction, it says okay, they want me to print something out again.

When it prints that out, it goes down to this instruction, etc.

So Python is actually going to exècute执行the lines of code that we write in order.

So the order in which I write the instructions matters a lot.

So for example, if I was to take this last line here, and put it up here at the top.

Now when I save the file instead of just drawing out that triangle, it's going to draw out this little up-side down bottom thing at the top and then the rest of the triangle down here.

So the order of the instructions actually matters a lot. So this is basically how your Python programs are going to go.

As we go through this course, we're going to learn more and more of these little lines.

So here, we're just using this little print function, basically, it just prints something out onto the screen.

There's a bunch of little things like this that we can learn as we go through, we'll learn more and more instructions that we can give to the computer.

But in this lesson, I just want to kind of show you guys the basics, right?

We can essentially just dèfine定义 these little instructions for the computer and the computer will execute them in order.

In this tutorial, I want to talk to you guys about using váríäbles变量 in Python. Now in Python, you're going to be dealing with a lot of data.

So a lot of times in our program, we're going to be working with all types of information and data and values. And sometimes that data can be difficült to manage.

So in Python, we have this thing called a variable. And it's basically just a container, where we can store cêrtäin肯定 data values. And when we use a variable, when we put those data values inside containers, it makes it a lot easier for us to work with and manage all of the different data inside of our programs.

So variables are extreēmely极其 helpful. And it's sort of like a cõre核心topic in Python that you're really going to want to know in master.

So in this tutorial, I'm going to teach you guys everything you need to know to get started with variables, we're going to look at what they are, why they're useful, and we'll look at the different types of variables and the different types of data that we can store inside of variables.

But over here in my Python file, I just have a very simple program.

And it's basically just printing some text out onto the screen. And so this is actually a little story that I wrote.

It says there once was a man named George, he was 70 years old. He really liked the name George but didn't like being 70.

So this is a valid有效Python program. I could go ahead and run this program. And you'll see down here in the console, everything prints out and it looks great.

So we have an awesome little Python program here. But let's say that inside of our story, I wanted to change the charäctër's角色name. So instead of naming the character George, let's say I wanted to name the character John.

Well, I'm going to have to go through and I'm going to have to manúälly手动的 change the name George to the name John at every place inside of this story where it's mentioned. So I'm going to have to go over here and I'll say okay, John, I'm going to have to manually change that.

And then, okay, down here, we're gonna have to again manually type in John and change it to John.

So in order to change the character's name, I had to manually go in and change it in both places.

And now let's say okay, maybe we want to change the character's name age also.

So in äddition加法 to 除此之外changing the name, we also want to change the age, let's make them a little bit younger.

So why don't we say John is going to be 35. And so you'll see here I had to come here and manually change the age and then come down here and manually change it again.

Right. And now that we changed it, like it's going to work, it's going to be updated in our program. But you'll notice that in order to make that change, like I had to look through the entire program, find it where that value was and change it.

And this was only with four lines of the story.

Imagine if I had a story that was like thousands of lines long. And we mentioned the character's name and age, like hundreds of times. I mean, I'd have to look through each one of those lines and manually change the character's name.

And that is not a very good way for us to do this. And it's really not a good way for us to manage the data in our program, right? The character's name and the age.

 And so we can actually use a variable in order to store the character's name and the character's age.

And when we use that variable, it'll make it a lot easier for us to put the character's name and age inside of our little program here.

So I'm going to show you guys how we can create a variable for the character's name and age. And I'm just going to go up here äbôve this print statement.

标签:going,教程,just,re,python,here,Python,修订版,So
From: https://blog.csdn.net/2201_75998188/article/details/142463254

相关文章

  • 数据探索Python数据分析入门指南
    在数据驱动的商业环境中,数据分析已成为一项至关重要的技能。Python,以其简洁的语法和强大的数据处理库,成为了数据分析领域的首选语言。本文将为您提供一份Python数据分析的入门指南,帮助您开启数据探索之旅。为什么选择Python进行数据分析?易于学习:Python语法简洁,易于上手,适合初学者。......
  • python+vue中小学班级课外活动管理系统pycharm毕业设计项目_0390d
    目录解决的思路技术栈和环境说明python语言操作可行性性能/安全/负载方面具体实现截图框架介绍技术路线python-flask核心代码部分展示python-django核心代码部分展示详细视频演示源码获取解决的思路前端的数据收集及可视化研究,熟悉Django框架,python编程设计语法。......
  • Python数据分析入门教程
    在数据驱动的商业环境中,数据分析已成为一项至关重要的技能。Python,以其简洁的语法和强大的数据处理库,成为了数据分析领域的首选语言。本文将为您提供一份Python数据分析的入门指南,帮助您开启数据探索之旅。为什么选择Python进行数据分析?易于学习:Python语法简洁,易于上手,适合初学......
  • 利用Python开发Exporter,集成Prometheus和Grafana对进程监控
    利用Python开发Exporter,集成Prometheus和Grafana对进程监控在现代软件开发和运维中,监控是确保系统稳定运行和快速响应问题的重要手段。Prometheus和Grafana的组合是监控领域的强大工具,它们能够收集、处理和展示各种指标数据。本文将介绍如何利用Python开发一个Exporter,通过Promet......
  • 【2024最新版】超详细Burpsuite安装保姆级教程-适合入门小白
    在CTF比赛中或者是抓包中我们都会用到一个工具Burpsuite,但是有很多小伙伴们刚入门安全,不知道该如何去安装这个Burpsuite,今天我就来教大家如何安装Burpsuite第一次使用先按照下面的教程激活,激活后无需再次激活下载链接极核GetShell在下载链接下方,我们可以选择windows和Linux......
  • 8种数值变量的特征工程技术:利用Sklearn、Numpy和Python将数值转化为预测模型的有效特
    特征工程是机器学习流程中的关键步骤,在此过程中,原始数据被转换为更具意义的特征,以增强模型对数据关系的理解能力。特征工程通常涉及对现有数据应用转换,以生成或修改数据,这些转换后的数据在机器学习和数据科学的语境下用于训练模型,从而提高模型性能。本文主要介绍处理数值变量特......
  • MySQL零基础入门教程-8.1 表的连接\增删数据、表结构的增删改、字段约束(非空、唯一
    教程来源:B站视频BV1Vy4y1z7EX001-数据库概述_哔哩哔哩_bilibili我听课收集整理的课程的完整笔记,供大家学习交流下载:夸克网盘分享本文内容为完整笔记的第八篇的第一部分1、表怎么进行连接的P77-P1431、表怎么进行连接的从emp表中取ename,从dept表中取dname,没有条件限制最终查询结果是......
  • 渣男滚远点智能体开发教程
    创建一个名为“渣男滚远点”的智能体,旨在帮助用户识别并远离渣男行为,可以是一个有趣且实用的项目。以下是一个基于文心智能体平台(AgentBuilder)的零代码开发教程:1.准备阶段1.1访问平台访问文心智能体平台(AgentBuilder)的官网:https://agents.baidu.com/center。1.2注册与登录在官网......
  • 一篇文章教你用python玩转数据透视表PivotTable
    目录建数据透视表 配置行列字段添加列字段配置“值字段” 关闭分类汇总设置表格形式显示读取数据来透视表内容读取rowfield的内容读取valuefield的内容筛选透视表添加行标签筛选添加筛选标签(Pagefield)排序透视表 本文主要介绍excel的数据透视表常见的操......
  • python在word文档中搜索关键词,复制段落
    目录简介:打开原始word文档创建一个新的文档(存放摘抄内容)搜索关键词复制和粘贴匹配的段落简介:本文示例的流程:打开一个word文档,搜索关键词所在的段落,并将对应段落复制粘贴到新的word文档中,并标记出处文件名和页码。可以用来批量对word文档进行提取。打开原始word文......