Python 导入错误:无法导入名称';播放器';从';卡片设置。卡片和x27;

Python 导入错误:无法导入名称';播放器';从';卡片设置。卡片和x27;,python,import,module,importerror,Python,Import,Module,Importerror,尝试学习Python时,我想使用模块和导入 我有卡片 class Cards(): #Some Code class Deck(): #Some Code class Player(): ''' A class for a player entity ''' def __init__(self, name): self.name = name self.all_cards = [] def remove_card(self): return self.al

尝试学习Python时,我想使用模块和导入

我有卡片

class Cards():
#Some Code

class Deck():
#Some Code
    
class Player():
'''
A class for a player entity
'''

def __init__(self, name):
    self.name = name
    self.all_cards = []

def remove_card(self):
    return self.all_cards.pop(0)

def add_cards(self, new_card):
    if type(new_card) == type([]):
        self.all_cards.extend(new_card)
    else:
        self.all_cards.append(new_card)


def __str__(self):
    return f'Player {self.name} has {len(self.all_cards)} cards'

def rprint(self):
    print(f"Player {self.name}'s cards:")
    for item in self.all_cards:
        print(item)
    print('\n \n')
和war.py

from random import shuffle
from colorama import init, Fore, Back
from card_setup.cards import Deck, Cards, Player
import pdb;
init()
当我运行war.py时,会出现以下错误:

回溯(最近一次呼叫最后一次): 文件“war.2.py”,第6行,在 从card_setup.cards导入牌组、牌、玩家 ImportError:无法从“卡\u设置.卡”导入名称“玩家”


它成功地导入了本模块中的另外两个类,但没有导入第三个类,这是否回答了您的问题?