python - 在 IDLE 上导入文件(python 代码编辑器)
问题描述
这似乎是一个愚蠢的问题,但我确实遇到了很多麻烦:我需要能够将文件(如图像)导入 IDLE,以便在程序运行时打开它。我是否遗漏了一些非常明显的东西,或者这在 IDLE 上是不可能的?谢谢。顺便说一句,我在 Python 中使用 Chromebook。
解决方案
from PIL import Image
with Image.open(image_directory) as image:
pass
From there you can use PIL's various functions to edit the image. Don't forget to save it, though.
推荐阅读
- c - 计算和打印矩阵的对角线之和
- javascript - 如何在 Angular 中使用 addEventListener 和 postMessage?
- php - 如何将日期、时间和值从单选按钮放入数据库
- c# - 逐个像素地动态绘制和显示,有一些延迟
- npm - 如何从 Nexus oss 代理获取依赖于 github 项目的 npm 包
- django - Django 测试 - 发送包含整数的数组数组
- android - 在 android 中使用改造登录
- json - 我如何在 nunjuncks 中乘以数据?
- swift - 为什么不能在swift中将可变参数标记为inout?
- vue.js - Vue Js 2 / Vue-CLI 3 / 托管时显示空白页