英文:
Where does PIL.Image.open() search for image when only the filename is given?
问题
我需要制作一个人们可以在Python上下载的象棋游戏的变种,但现在我需要图像。
(还有一件非常令人惊讶的事情是,文件资源管理器中显示的目录有时与PyCharm中的目录不同)
我尝试将它们放在venv旁边,但没有成功。我还尝试将它们放在Scripts中,但也没有成功。
英文:
I need to make a variation of chess game where people can download it on python but i need images now.
(Also something very surprising is that the directory shown in File Explorer is sometimes different than the directory in pycharm)
I tried putting them beside venv but it didn't work. I also tried in Scripts but i didn't work either.
答案1
得分: 0
它查看当前目录。您可以通过运行以下代码来查看当前目录:
import os
print(f'当前目录:{os.getcwd()}')
英文:
It looks in the current directory. You can see where that is by running this:
import os
print(f'Current directory: {os.getcwd()}')
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论