[英]Can not figure out why my if/else statement doesn`t work like i intend
[英]Can't figure out why I can't import this one class, I feel like it should work
我在一个文件中创建了一个简单的类,该文件与我尝试发送的目录位于同一目录中。 但是,由于某些未知原因,我终生无法弄清楚为什么导入不起作用。 任何帮助都会很棒。
我已经用谷歌搜索了很多,但找不到任何特定于我的东西
有问题的类(名为 location1.py 的文件)
class Location:
def __init__(self, name, txt_display, been_there):
self.name = name
self.txt_display = txt_display
self.been_there = been_there
我所有的导入(名为 mainPart1.py 的文件)
import random
from tkinter import *
from location1 import *
from PIL import ImageTk, Image
我是如何测试的
temp = Loction("1a", "display poo", True)
print(temp.name)
“NameError: name 'Loction' is not defined” 我从终端得到这个,我不知道该怎么做。 我期待“1a”
你有一个错字,它应该是Location
您的代码:
temp = Loction("1a", "display poo", True)
应该:
temp = Location("1a", "display poo", True
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.