python - Cannot import classes.(something) in Pycharm when that 'something' has already been defined
问题描述
import classes.game import bcolors, Person
解决方案
If you type from classes.game import bcolors, Person
, python will look for a file called classes.game.py, which doesn't exist.
Instead you should do
from game import bcolors, Person
as you're trying to import from the module 'game.py'.
推荐阅读
- javascript - 如何在多个鼠标悬停上更改光标
- d3.js - Music21 和 D3.js 用于音乐特征提取和可视化?
- go - Golang 中 main 函数中的两个 .RUN() 函数
- phaser-framework - 在移相器 3 中将元素置于最前面的功能?
- c# - 将 Powershell 窗口的输出提取到字符串
- sql - 需要帮助重构此查询
- html - 带有 srcdoc 的 iframe:同页链接在框架中加载父页面
- compiler-errors - 奇怪地重复出现的通用特征模式:溢出评估需求
- php - 是否可以在同一个 php 页面中打印 javascript 数组
- android - 共享偏好在 OREO 中被删除