问题描述
大家早上好,我必须使用我编写的函数来模拟from PIL import Image,ImageDraw
# Open the image
im = Image.open('image.png')
# Make a list of the annotation texts
words = ['the','cat','sat','on','the','mat']
# Iterate over all annotations
for word in words:
# Take a clean copy of original image - the following line is the actual answer
clear = im.copy()
# Draw the text on the clean copy and save
draw = ImageDraw.Draw(clear)
draw.text((10,10),word)
clear.save(word + '.png')
函数的操作。
在代码中,我将原始字符串滑动到一个临时字符串中,然后与要查找的字符串进行比较,如果它们相等,则应返回strstr()
。
但是,即使字符串相等且长度相同,代码也永远不会进入1
循环,因此也就永远不会返回if
。
我的代码:
1
有人知道我错了吗?
谢谢!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)