【发布时间】:2021-03-03 02:26:00
【问题描述】:
我正在尝试从其他文件夹中的其他文件导入信息,但我的程序一直显示“需要标识符”
from builtins import object
import os
import pygame
import random
pygame.init()
os.environ['SDL_VIDEO_WINDOW_POS'] = '0, 30'
from folder1 import 'splash text.txt*'
splashget = open('splash text.txt', 'r')
splashget = splashget.readlines()
splashtextchoice = random.choice(splashget)
screenwidth = 1920
screenheight = 1080
win = pygame.display.set_mode((screenwidth, screenheight))
我的文件结构是这样组织的:
Project
|
-----App
|
-----Folder1
|
-------splash text.txt
错误出现在 from folder1 import 'splash text.txt'* 在第一个撇号上。这个文本文件上有几个小短语,每个小短语都换行。有什么帮助解决这个问题吗?
【问题讨论】:
标签: python import python-import