做了那么多年开发,自学了很多门编程语言,我很明白学习资源对于学一门新语言的重要性,这些年也收藏了不少的Python干货,对我来说这些东西确实已经用不到了,但对于准备自学Python的人来说,或许它就是一个宝藏,可以给你省去很多的时间和精力。
别在网上瞎学了,我最近也做了一些资源的更新,只要你是我的粉丝,这期福利你都可拿走。
我先来介绍一下这些东西怎么用,文末抱走。
(1)Python所有方向的学习路线(新版)
这是我花了几天的时间去把Python所有方向的技术点做的整理,形成各个领域的知识点汇总,它的用处就在于,你可以按照上面的知识点去找对应的学习资源,保证自己学得较为全面。
最近我才对这些路线做了一下新的更新,知识体系更全面了。
(2)Python学习视频
包含了Python入门、爬虫、数据分析和web开发的学习视频,总共100多个,虽然没有那么全面,但是对于入门来说是没问题的,学完这些之后,你可以按照我上面的学习路线去网上找其他的知识资源进行进阶。
(3)100多个练手项目
我们在看视频学习的时候,不能光动眼动脑不动手,比较科学的学习方法是在理解之后运用它们,这时候练手项目就很适合了,只是里面的项目比较多,水平也是参差不齐,大家可以挑自己能做的项目去练练。
(4)200多本电子书
这些年我也收藏了很多电子书,大概200多本,有时候带实体书不方便的话,我就会去打开电子书看看,书籍可不一定比视频教程差,尤其是权威的技术书籍。
基本上主流的和经典的都有,这里我就不放图了,版权问题,个人看看是没有问题的。
(5)Python知识点汇总
知识点汇总有点像学习路线,但与学习路线不同的点就在于,知识点汇总更为细致,里面包含了对具体知识点的简单说明,而我们的学习路线则更为抽象和简单,只是为了方便大家只是某个领域你应该学习哪些技术栈。
(6)其他资料
还有其他的一些东西,比如说我自己出的Python入门图文类教程,没有电脑的时候用手机也可以学习知识,学会了理论之后再去敲代码实践验证,还有Python中文版的库资料、MySQL和HTML标签大全等等,这些都是可以送给粉丝们的东西。
这些都不是什么非常值钱的东西,但对于没有资源或者资源不是很好的学习者来说确实很不错,你要是用得到的话都可以直接抱走,关注过我的人都知道,这些都是可以拿到的。
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
“”"
#配置玩家属性
player_property = {u"名字":u"卡尔",u"生命值":100,u"攻击力":10,u"护甲":10,u"经验":0,u"符号":“(_)”}
##配置怪物属性
Slime_property = {u"名字":u"史莱姆",u"生命值":25,u"攻击力":15,u"护甲":15,u"符号":“0Y0”}
wizard_property = {u"名字":u"巫师",u"生命值":50,u"攻击力":40,u"护甲":10,u"符号":“>@Y@<”}
knight_property = {u"名字":u"骑士",u"生命值":350,u"攻击力":30,u"护甲":50,u"符号":“\OYO/”}
s_devil_property = {u"名字":u"小魔王",u"生命值":400,u"攻击力":100,u"护甲":100,u"符号":“~/-Y-~”}
g_devil_property = {u"名字":u"大魔王",u"生命值":3000,u"攻击力":300,u"护甲":300,u"符号":“~~//-Y-\~~”}
princess_property = {u"名字":u"公主",u"符号":“o”}
def fight(monster):
u"“”
函数功能:让玩家和怪物进行战斗,若玩家胜利,则设置玩家剩余生命值,若失败,则退出游戏。
输入参数:monster–怪物,有效的值:u"史莱姆",u"巫师",u"骑士",u"小魔王",u"大魔王"
“”"
global player_property,Slime_property,wizard_property
global knight_property,s_devil_property,g_devil_property
#判断是什么怪物
if monster == Slime_property[u"名字"]:
monster_property = copy.deepcopy(Slime_property)
elif monster == wizard_property[u"名字"]:
monster_property = copy.deepcopy(wizard_property)
elif monster == knight_property[u"名字"]:
monster_property = copy.deepcopy(knight_property)
elif monster == s_devil_property[u"名字"]:
monster_property = copy.deepcopy(s_devil_property)
elif monster == g_devil_property[u"名字"]:
monster_property = copy.deepcopy(g_devil_property)
elif monster == princess_property[u"名字"]:
print u"是不是傻!公主你也杀。"
exit()
else:
print u"怪物名字输入错误!"
exit()
#开始战斗
who_round = “player”
while player_property[u"生命值"] > 0 and monster_property[u"生命值"] > 0:
if who_round == “player”:
monster_property[u"生命值"] -= (player_property[u"护甲"] + player_property[u"攻击力"])
who_round = “monster”
else:
player_property[u"生命值"] -= (monster_property[u"护甲"] + monster_property[u"攻击力"])
who_round = “player”
#战斗结果处理
if player_property[u"生命值"] <= 0:
print u’“不自量力的家伙,哼!” 怪物将你大卸八块,吃掉了!’
print u"你被打败了,游戏结束!"
exit()
else:
print u"你打败了怪物,赢得了胜利,获得25点经验!"
player_property[u"经验"] += 25
#打败小魔王升3级
if monster == s_devil_property[u"名字"]:
print u"打败小魔王,连升3级!生命值+300,攻击力加30,护甲加30!"
player_property[u"生命值"] += 300
player_property[u"攻击力"] += 30
player_property[u"护甲"] += 30
#打败大魔王游戏结束
if monster == g_devil_property[u"名字"]:
print u"“”
“啊~不,不可能!我竟然被打败了!”,大魔王怒吼道,
“既然你打败了我,那么我就要你陪葬,你们谁都跑不了,哈哈哈哈哈~”
这时地动山摇,墙壁开裂,屋顶的石头不断落下,魔塔开始坍塌。
你趁机从墙壁的裂缝里溜了出去,救出了公主。
从此,英雄卡尔的名字成了一个传说~
恭喜你,通关!
“”"
exit()
#经验达到100升级属性
if player_property[u"经验"] == 100:
print u"恭喜你,升了1级,生命值+100,攻击力加10,护甲加10!"
player_property[u"生命值"] += 100
player_property[u"攻击力"] += 10
player_property[u"护甲"] += 10
player_property[u"经验"] = 0
def forecast_fight(monster):
u"“”
函数功能:预测玩家和怪物战斗需要的生命值
输入参数:monster–怪物名字,有效的值:u"史莱姆",u"巫师",u"骑士",u"小魔王",u"大魔王"
返回参数:health–消耗玩家的生命值
“”"
global player_property,Slime_property,wizard_property
global knight_property,s_devil_property,g_devil_property
#判断是什么怪物
if monster == Slime_property[u"名字"]:
monster_property = copy.deepcopy(Slime_property)
elif monster == wizard_property[u"名字"]:
monster_property = copy.deepcopy(wizard_property)
elif monster == knight_property[u"名字"]:
monster_property = copy.deepcopy(knight_property)
elif monster == s_devil_property[u"名字"]:
monster_property = copy.deepcopy(s_devil_property)
elif monster == g_devil_property[u"名字"]:
monster_property = copy.deepcopy(g_devil_property)
else:
print u"怪物名字输入错误!"
exit()
player_health = player_property[u"生命值"]
#模拟战斗
who_round = “player”
while monster_property[u"生命值"] > 0:
if who_round == “player”:
monster_property[u"生命值"] -= (player_property[u"护甲"] + player_property[u"攻击力"])
who_round = “monster”
else:
player_health -= (monster_property[u"护甲"] + monster_property[u"攻击力"])
who_round = “player”
#计算消耗的血量
health = player_property[u"生命值"] - player_health
return health
def find_goods(goods):
u"“”
函数功能:搜索物品
输入参数:goods–物品,类型–列表
“”"
if goods == []:
print u"什么都没找到!"
else:
for good in goods:
if good == u"小血瓶":
print u"你获得一个小血瓶,生命值增加100点!"
player_property[u"生命值"] += 100
elif good == u"中血瓶":
print u"你获得一个中血瓶,生命值增加200点!"
player_property[u"生命值"] += 200
elif good == u"大血瓶":
print u"你获得一个大血瓶,生命值增加400点!"
player_property[u"生命值"] += 400
elif good == u"超大血瓶":
print u"你获得一个超大血瓶,生命值增加600点!"
player_property[u"生命值"] += 600
elif good == u"圣水":
print u"你获得一瓶圣水,生命值增加一倍!攻击力增加一倍!护甲增加一倍!"
player_property[u"生命值"] *= 2
player_property[u"攻击力"] *= 2
player_property[u"护甲"] *= 2
elif good == u"圣剑":
print u"你获得一把圣剑,攻击力增加100!"
player_property[u"攻击力"] += 100
elif good == u"圣盾":
print u"你获得一个圣盾,护甲增加100!"
player_property[u"护甲"] += 100
elif good == u"钥匙":
print u"你获得一把钥匙!"
else:
print u"物品名称错误!"
display.py
-*- coding:utf-8 -*-
import copy
import fight
u"“”
这个模块提供一些实现显示功能的函数。
“”"
def display_pos(room):
u"“”
函数功能:显示当前所在位置
输入参数:room–房间号 ,类型–字符串
“”"
room_dict = {‘room1’:1,‘room2’:2,‘room3’:3,‘room4’:4,‘room5’:5,
‘room6’:6,‘room7’:7,‘room8’:8,‘room9’:9,
‘palace’:0,‘basement’:10}
pos = [’ ‘,’ ‘,’ ‘,’ ‘,’ ‘,’ ‘,’ ‘,’ ‘,’ ‘,’ ‘,’ ‘]
pos[room_dict.get(room)] = 2
print u"“”
================
| 神秘房间 |
| %c |
—=
| 房间1 | 房间2 | 房间3 |
| %c | %c | %c |
| | | |
|=|=|=|
| 房间4 | 房间5 | 房间6 |
| %c | %c | %c |
| | | |
|=|=|=|
| 房间7 | 房间8 | 房间9 |
| %c | %c | %c |
| | | |
=—=
| 地下室 |
| %c |
================
“”" % (pos[0],pos[1],pos[2],pos[3],pos[4],pos[5],pos[6],pos[7],pos[8],pos[9],pos[10])
def display_room(player_pos,monster,monster_pos,door_pos,goods):
u"“”
函数功能:显示房间内的景象。
输入参数:
玩家的位置–player_pos,类型–字符串,有效的值–“up”,“left”,“right”,“down”,“middle”,0(不存在)
怪物的种类–monster,类型–字符串
有效的值: “史莱姆” 0Y0
“巫师” >@Y@<
“骑士” \OYO/
“小魔王” ~/-Y-~
“大魔王” ~~//-Y-\~~
“公主” o
“” 不存在怪物
怪物的位置–monster_pos,类型–列表 空列表表示不存在怪物
列表中每个元素,代表一个怪物的位置,类型–字符串,有效的值–“up”,“left”,“right”,“down”,“middle”
门的位置–door_pos,类型–列表 空列表表示不存在门
列表中每个元素–代表一个门的位置,类型–字符串,有效的值–“up”,“left”,“right”,“down”
物品的种类–goods,类型–列表 空列表表示不存在物品
列表中每个元素–代表一种物品,类型–字符串
有效的值:“Excalibur” 圣剑 ±–
“圣盾” [+]
“钥匙” C=–
“小血瓶” (o)
“中血瓶” (oo)
“大血瓶” (ooo)
“超大血瓶” (oooo)
“圣水” [o]
“地图” [|]
备注:玩家图形: (_)
“”"
drawlist = []
good_pos = [6,7,9]
for i in range(14):
drawlist.append(’ ')
if player_pos == “up”: #根据输入参数,让玩家图形在对应的位置显示
drawlist[2] = convert_sign(fight.player_property[u"符号"])
elif player_pos == “down”:
drawlist[12] = convert_sign(fight.player_property[u"符号"])
elif player_pos == “left”:
drawlist[5] = convert_sign(fight.player_property[u"符号"])
elif player_pos == “right”:
drawlist[10] = convert_sign(fight.player_property[u"符号"])
elif player_pos == “middle”:
drawlist[7] = convert_sign(fight.player_property[u"符号"])
else:
print u"玩家位置错误!"
if monster == u"史莱姆": #根据输入参数,设置怪物图形
monster_sign = convert_sign(fight.Slime_property[u"符号"])
elif monster == u"巫师":
monster_sign = convert_sign(fight.wizard_property[u"符号"])
elif monster == u"骑士":
monster_sign = convert_sign(fight.knight_property[u"符号"])
elif monster == u"公主":
monster_sign = convert_sign(fight.princess_property[u"符号"])
elif monster == u"小魔王":
monster_sign = convert_sign(fight.s_devil_property[u"符号"])
elif monster == u"大魔王":
monster_sign = convert_sign(fight.g_devil_property[u"符号"])
elif monster == “”:
pass
else:
print u"怪物名称错误!"
monster_sign = convert_sign(" “)
for mon in monster_pos: #根据输入参数,让怪物图形在对应的位置显示
if mon == “up”:
drawlist[2] = monster_sign
elif mon == “down”:
drawlist[12] = monster_sign
elif mon == “left”:
drawlist[5] = monster_sign
elif mon == “right”:
drawlist[10] = monster_sign
elif mon == “middle”:
drawlist[7] = monster_sign
else:
print u"怪物位置错误!”
for door in door_pos: #根据输入参数,让门图形在对应的位置显示
if door == “up”:
drawlist[0] = ‘_ ’
drawlist[1] = ‘\b| |’
elif door == “down”:
drawlist[13] = ‘\b|_|’
elif door == “left”:
drawlist[3] = ‘|\’
drawlist[4] = ’ \’
elif door == “right”:
drawlist[8] = ‘/|’
drawlist[11] = '/ ’
else:
print u"门位置错误!"
for good in goods: #根据输入参数判断是什么物品,并显示在指定的位置
if good == u"圣剑":
gooddraw = convert_sign(“±–”)
elif good == u"圣盾":
gooddraw = convert_sign(“[+]”)
elif good == u"钥匙":
gooddraw = convert_sign(“C=–”)
elif good == u"小血瓶":
gooddraw = convert_sign(“(o)”)
elif good == u"中血瓶":
gooddraw = convert_sign(“(oo)”)
elif good == u"大血瓶":
gooddraw = convert_sign(“(ooo)”)
elif good == u"超大血瓶":
gooddraw = convert_sign(“(oooo)”)
elif good == u"圣水":
gooddraw = convert_sign(“[o]”)
elif good == u"地图":
gooddraw = convert_sign(“[|]”)
else:
print u"物品名称错误!"
continue
drawlist[good_pos.pop(0)] = gooddraw
draw = (drawlist[0],drawlist[1],drawlist[2],drawlist[3],drawlist[4],
drawlist[5],drawlist[6],drawlist[7],drawlist[8],drawlist[9],drawlist[10],
drawlist[11],drawlist[12],drawlist[13])
print “”"
==================================
|- -|
| - %s - |
| - %s - |
| -------------------------- |
| - %s - |
|%s - - |
|%s - %s %s - |
| - %s - %s|
| - %s %s - %s|
| - %s - |
| -------------------------- |
| - %s - |
==================================
“”" % draw
##输入图形格式转换函数,保证%s所在位置就是字符串的最右端,用于对齐格式
def convert_sign(sign):
return ‘\b’*(len(sign)-2) + sign
def display_property(monster):
u"“”
函数功能:显示玩家和怪物属性
输入参数:monster–怪物名字,类型:字符串
有效的值: u"史莱姆",u"巫师",u"骑士",u"小魔王",u"大魔王",“”(不存在怪物)
“”"
monster_exist = True
#判断是什么怪物
if monster == fight.Slime_property[u"名字"]:
monster_property = copy.deepcopy(fight.Slime_property)
elif monster == fight.wizard_property[u"名字"]:
monster_property = copy.deepcopy(fight.wizard_property)
elif monster == fight.knight_property[u"名字"]:
monster_property = copy.deepcopy(fight.knight_property)
elif monster == fight.s_devil_property[u"名字"]:
monster_property = copy.deepcopy(fight.s_devil_property)
elif monster == fight.g_devil_property[u"名字"]:
monster_property = copy.deepcopy(fight.g_devil_property)
elif monster == “”:
monster_exist = False
else:
print u"怪物名字输入错误!"
exit()
if monster_exist == True:
draw = (convert_sign(fight.player_property[u"符号"]),convert_sign(fight.player_property[u"名字"]),
fight.player_property[u"生命值"],fight.player_property[u"攻击力"],fight.player_property[u"护甲"],
convert_sign(monster_property[u"符号"]),convert_sign(monster_property[u"名字"]),
monster_property[u"生命值"],monster_property[u"攻击力"],monster_property[u"护甲"],
fight.forecast_fight(monster_property[u"名字"]))
else:
draw = (convert_sign(fight.player_property[u"符号"]),convert_sign(fight.player_property[u"名字"]) ,
fight.player_property[u"生命值"],fight.player_property[u"攻击力"],
fight.player_property[u"护甲"],“”,“”,“”,“”,“”,“”)
print u"“”
_________________________________________________
生命值 攻击力 护甲 战斗预测
%s
%s %s %s %s
%s
%s %s %s %s %s
_________________________________________________
“”" % draw
#测试
display_property(0)
display_property(u"史莱姆")
display_property(u"骑士")
display_property(u"大魔王")
# #房间1
# print u"房间1"
display_room(“right”,0,[],[“right”],[u"圣剑",u"钥匙",u"中血瓶"])
# #房间2
# print u"房间2"
display_room(“down”,u"巫师",[“left”,“right”,“up”,“middle”],[“left”,“up”,“down”],[])
# #房间3
print u"房间3"
display_room(“down”,0,[],[“down”],[u"大血瓶",u"圣盾"])
# #房间4
print u"房间4"
display_room(“right”,u"史莱姆",[“left”,“down”,“up”,“middle”],[“right”,“down”],[])
# #房间5
print u"房间5"
display_room(“middle”,0,[],[“up”,“left”,“right”,“down”],[])
# #房间4
print u"房间6"
display_room(“left”,u"小魔王",[“middle”],[“left”,“up”],[])
# #房间1
print u"房间7"
display_room(“up”,0,[],[“up”],[u"地图",u"小血瓶"])
# #房间8
print u"房间8"
display_room(“up”,u"骑士",[“left”,“down”,“right”,“middle”],[“up”,“right”,“down”],[])
print u"房间9"
display_room(“left”,0,[],[“left”],[u"圣水",u"大血瓶"])
# #恐怖之地
print u"恐怖之地"
display_room(“down”,u"大魔王",[“middle”],[“down”],[])
# #地下室
print u"地下室"
display_room(“up”,u"公主",[“middle”],[“up”],[])
game.py
-*- coding:utf-8 -*-
import display
import fight
class Room(object):
def choose_do(self,lastroom):
#根据上个房间的号码和当前房间号码的差得到当前玩家在房间里的位置
compare = lastroom - self.roomnum
if compare == -3:
self.player_pos = “up”
elif compare == -1:
self.player_pos = “left”
elif compare == 1:
self.player_pos = “right”
elif compare == 3:
self.player_pos = “down”
else:
pass
#显示房间场景
display.display_room(self.player_pos,self.monster,
self.monster_pos,self.door_pos,self.goods)
while True:
print u"你可以选择:1、搜索房间 2、离开房间 3、查看小地图 4、查看自己的属性 5、消灭怪物"
choice = raw_input(“>”)
if choice == ‘1’:
if self.goods != []:
print self.word
fight.use_goods(self.goods)
self.goods = []
else:
print u"\t什么也没有!\n"
elif choice == ‘2’:
while True:
print u"请选择你要进入的房间:W:上 A:左 S:下 D:右 Q:返回"
choose_room = raw_input(‘>’)
if choose_room == “w”:
choose_room = “up”
elif choose_room == “a”:
choose_room = “left”
elif choose_room == “s”:
choose_room = “down”
elif choose_room == “d”:
choose_room = “right”
elif choose_room == ‘q’:
break
else:
pass
if choose_room not in self.door_pos:
print u"选择错误!"
else:
if choose_room in self.monster_pos:
print u"你必须打败门口的守卫,才能进入这个房间!"
else:
if choose_room == “up”:
return self.roomnum - 3
elif choose_room == “left”:
return self.roomnum - 1
elif choose_room == “down”:
return self.roomnum + 3
elif choose_room == “right”:
return self.roomnum + 1
else:
pass
elif choice == ‘3’:
display.display_pos(self.roomnum)
elif choice == ‘4’:
display.display_property(self.monster)
elif choice == ‘5’:
if self.monster_pos == []:
print u"没有怪物!"
else:
print u"请选择你要攻击的怪物:W:上 A:左 S:下 D:右 E:中 Q:返回"
choose_monster = raw_input(‘>’)
if choose_monster == “w”:
choose_monster = “up”
elif choose_monster == “a”:
choose_monster = “left”
elif choose_monster == “s”:
choose_monster = “down”
elif choose_monster == “d”:
choose_monster = “right”
elif choose_monster == “e”:
choose_monster = “middle”
elif choose_monster == ‘q’:
continue
else:
pass
if choose_monster not in self.monster_pos:
print u"这个地方没有怪物!"
continue
fight.fight(self.monster)
self.monster_pos.remove(choose_monster)
else:
print u"输入错误!"
class Room1(Room):
def __init__(self):
self.roomnum = 1
self.player_pos = “right”
self.goods = [u"圣剑",u"钥匙",u"中血瓶"]
self.monster = 0
self.monster_pos = []
self.door_pos = [“right”]
self.word = u"“”
得到一把圣剑 ±–,攻击力上升100!
得到一个中血瓶 (oo),生命值上升200!
得到一把钥匙 C=–!
“”"
def story_room(self,lastroom):
u"“”
函数功能:交代room1剧情,显示房间场景,获取用户选择,做相应处理。
输入参数:无
返回参数:self.nextroom–下个房间的号码,类型–数字类型
0–神秘房间 10–地下室
“”"
print u"房间1"
if self.goods != []:
print u"你进入了一个昏暗的房间,房间里似乎有一些东西在发光!"
else:
print u"你进入了一个昏暗的房间,房间里空无一物。"
#进入游戏循环
return Room.choose_do(self,lastroom)
class Room2(Room):
def __init__(self):
self.roomnum = 2
self.player_pos = " "
self.goods = []
self.monster = u"巫师"
self.monster_pos = [“up”,“middle”,“left”,“right”]
self.door_pos = [“left”,“up”,“down”]
self.word = u"“”
“”"
def story_room(self,lastroom):
u"“”
函数功能:交代room2剧情,显示房间场景,获取用户选择,做相应处理。
输入参数:无
返回参数:self.nextroom–下个房间的号码,类型–数字类型
-1–神秘房间 11–地下室
“”"
#剧情交代
print u"房间2"
现在能在网上找到很多很多的学习资源,有免费的也有收费的,当我拿到1套比较全的学习资源之前,我并没着急去看第1节,我而是去审视这套资源是否值得学习,有时候也会去问一些学长的意见,如果可以之后,我会对这套学习资源做1个学习计划,我的学习计划主要包括规划图和学习进度表。
分享给大家这份我薅到的免费视频资料,质量还不错,大家可以跟着学习
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!