Python人工智能 - A计划(永久有效期) 扫二维码继续学习 二维码时效为半小时

(7评价)
优惠后 ¥1599.00优惠前 ¥1999.00 双十一全年最大力度限时优惠
1对1 答疑即时回复7天无理由退款30天价保提问必答

服务保障

1对1 答疑

提供专属的一对一在线答疑,快速答疑解惑。

即时回复

及时响应学习咨询,帮助解决问题。

7天无理由退款

购买后7天内可申请无理由退款。

30天价保

购买后30天内如遇降价,可申请价保。

提问必答

对于提问做到有问必答,帮您扫清学习过程中的种种障碍

字符串的拼接(+)

name = “梁”+str+”雯雯”

print(name)

print(“梁”+str+”雯雯”)

空白 - 空格 制表符\t 换行符\n

 

name = "Hello" + " World" + "!"

print("Hello " + "World" + name)#Hello WorldHello World!

print(name)#Hello World!

 

print("a b")#a b

print("a b")#a b

length = len("a b")

print(length)#3

#print(len("a b"))#6

print("a\tb")#a b

print("a\nb")

[展开全文]
遗失的星空 · 2020-05-11 · 0

几个常用方法

str.title()

str.upper()

str.lower()

len(str)

两种方法的区别 一种在前面 一种在后面

 

str.title() 没有影响原来的字符串,给你一个新的字符串

str.title() 把首字母大写

 

 

 

 

m5 = "my nAme is siki"

m6 = m5.title()

m7 = m5.upper()

m8 = m5.lower()

print(m5)#my nAme is siki

print(m6)#My Name Is Siki

print(m7)#MY NAME IS SIKI

print(m8)#my name is siki

 

str.title()把首字母变成大写

str.upper()把所有字母变成大写

str.lower()把所有字母变成小写

len(str)取得字符串的长度

 

m5 = "my nAme is siki"

m6 = m5.title()

m7 = m5.upper()

m8 = m5.lower()

print(m5)#my nAme is siki

print(m6)#My Name Is Siki

print(m7)#MY NAME IS SIKI

print(m8)#my name is siki

length = len(m5)

print(length)#15

 

m = "Hello World"
m2 = 'Hello World'
m3 = 'i "like" you'
m4 = "I'm fine"
#m5 = 'my name \' is " siki'
m5 = "my nAme is siki"
m6 = m5.title()
m7 = m5.upper()
m8 = m5.lower()
print(m5)#my nAme is siki
print(m6)#My Name Is Siki
print(m7)#MY NAME IS SIKI
print(m8)#my name is siki
length = len(m5)
print(length)#15
length1 = len("hello")
print(length1)#5

[展开全文]
遗失的星空 · 2020-05-11 · 0

print() 函数/方法

 

hp = 100

print(hp)

hp = 90

print(hp)

print("hp")

 

字符串类型

使用双引号或者单引号引起来,引起来部分是数据内容

第一个引号代表字符串开始,第二个引号代表字符串结尾

\转义字符

 

m = "Hello World"

m2 = 'Hello World'

m3 = "i "like" you"

报错

m3 = 'i "like" you'

 

m = "Hello World"

m2 = 'Hello World'

m3 = 'i "like" you'

m4 = "I'm fine"

m5 = 'my name \' is " siki'

m5 = "my name \' is \" siki"

print(m3)

 

 

 

 

[展开全文]
遗失的星空 · 2020-05-11 · 0

代码不能写在一行,会报错

 

msg = "Hello World"

print(msg)

print(msg)

print(msg)

print(msg)

print(msg)

 

 

引入变量的作用

当需要重复使用某一个数据时候

m=" "

print(m)

print(m)

print("m")

当需要存储一个需要变化的数据的时候(游戏中某个角色的血量)

 

变量

1,存储数据

2,可以变化

 

程序出错的时候怎么办?

新手最常见的错误 - 变量名写错

[展开全文]
遗失的星空 · 2020-05-11 · 0

数据类型和变量

计算机中的数据是什么

QQ:聊天的文字(字符)发布的说说文字(字符)年龄(数字)

数字和字符是重要数据。

计算机程序就是用来处理数据的

同样 Python 编写的程序也是用来处理数据的。

什么是数据类型

把不同类型的数据进行划分,就是使用数据类型。

目前:数字类型 字符类型 字符串类型

[展开全文]
遗失的星空 · 2020-05-11 · 0

如何更快速的运行 python 代码
    配置 notepad++
    cmd /k python.exe "$(FULL_CURRENT_PATH)"& PAUSE & EXIT
    保存

 

cmd /k python "$(FULL_CURRENT_PATH)"& PAUSE & EXIT

 

百度搜索:“notepad++ python运行”

https://jingyan.baidu.com/article/d5a880eb8ce81813f047cc4b.html

 

Mac OS 下下载 Python 环境
    下载 mac 版 python
    编辑器使用 Sublime Text
    https://www.jianshu.com/p/097362dcdea3

[展开全文]
遗失的星空 · 2020-05-11 · 0

桌面上:HelloWorld.py
C:\Users\souke\Desktop>python helloworld.py
HelloWorld

C:\Users\souke\Desktop>

 

 

C:\Users\souke\Desktop>python helloworld.py
  File "hellowrold.py", line 1
SyntaxError: Non-UTF-8 code starting with '\xal' in file hellowrold.py on line 1, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

C:\Users\souke\Desktop>

 

print("你好,python世界")

支持中文,需要更改编码格式:
格式---转为 UTF-8 编码格式

[展开全文]
遗失的星空 · 2020-05-11 · 0
>>>print("Hello World")
Hello World
>>>

 

集成开发环境(IDE,Integrated Development Environment )是用于提供程序开发环境的应用程序,一般包括代码编辑器、编译器、调试器和图形用户界面等工具。

 

Notepad++官网:

https://notepad-plus-plus.org/

 

下载Notepad++

https://notepad-plus-plus.org/downloads/

下载 Notepad++ v7.8.2 页面

https://notepad-plus-plus.org/downloads/v7.8.2/

[展开全文]
遗失的星空 · 2020-05-11 · 0

python官网:

https://www.python.org/

 

下载Python 3.8

https://www.python.org/downloads/release/python-380/

https://www.python.org/ftp/python/3.8.0/python-3.8.0.exe

 

Install Python 3.8.0(32-bit)

打勾选项:

Install launcher for all users (recommended)
Add python 3.8 to PATH

 

Setup was successful

Disable path length limit
Changes your machine configuration to allow programs,including Python,to bypass the 260 character "MAX_PATH" limitation.

Close

 

C:\Users\souke\python
Python 3.8.0 (tags/v3.8.0:fa919fd,Oct 14 2019,19:21:23)  [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

[展开全文]
遗失的星空 · 2020-05-11 · 0

Windows键 + R键,调用出 运行

exit() 退出python命令行

在 Windows 下搭建 Python 编程环境

1,检查是否已经安装 Python,如有卸载 Python

2,下载并安装 Python (python.ory)(勾选 add python to path)

3,检查是否安装成功

4,编写 HelloWorld

5,安装 notepad++

[展开全文]
遗失的星空 · 2020-05-11 · 0

Python2和3

互不兼容,一些老的项目还在使用2.

新学习使用最新版本3.8

 

新手的计算机基本知识

大小写切换 Windows键 shift键

[展开全文]
遗失的星空 · 2020-05-11 · 0

键值对:

stu1={'name':'siki','age':17,'gender':'男'}

 

[展开全文]
差点没头的哈莉 · 2020-05-11 · 0

\可以用来表示未结束

[展开全文]
冲冲冲女孩 · 2020-05-11 · 0

条件语句:

if age>40;

    print("进入青少年模式")

else:

    print("常规模式")

 

[展开全文]
差点没头的哈莉 · 2020-05-06 · 0

很多时候,列表内容不方便列举,用len(names)计数

 

[展开全文]
差点没头的哈莉 · 2020-05-05 · 0