我做错了什么
Traceback (most recent call last):
File "C:\Python27\tess1.py", line 4, in <module>
print(pytesseract.image_to_string(Image.open('example_01.png')))
File "build\bdist.win-amd64\egg\pytesseract\pytesseract.py", line 193, in
image_to_string
return run_and_get_output(image, 'txt', lang, config, nice)
File "build\bdist.win-amd64\egg\pytesseract\pytesseract.py", line 130, in
run_and_get_output
temp_name, img_extension = save_image(image)
File "build\bdist.win-amd64\egg\pytesseract\pytesseract.py", line 86, in
save_image
image.save(input_file_name, format=img_extension, **image.info)
File "C:\Python27\lib\site-packages\PIL\Image.py", line 1420, in save
self.load()
File "C:\Python27\lib\site-packages\PIL\ImageFile.py", line 193, in load
d = Image._getdecoder(self.mode, d, a, self.decoderconfig)
File "C:\Python27\lib\site-packages\PIL\Image.py", line 356, in
_getdecoder
raise IOError("decoder %s not available" % decoder_name)
IOError: decoder zip not available
和
line = client.readStringUntil('\r');
if (line.substring(0) == "1");
当我运行此代码时,串行打印行给了我:000
但接力1给了我:Rele 1关闭图表 - 检查你给我的东西....
如果我强迫
// Read all the lines of the reply from server and print them to Serial
while(client.available()){
line = client.readStringUntil('\r'); // String
Serial.println(line);
}
// Rele 1
if (line.substring(0) == "1")
{
Serial.println("Rele 1 ON");
digitalWrite(Rele_1, LOW);
myBr1 = 1;
}
else if (line.substring(0) == "0")
{
Serial.println("Rele 1 OFF");
digitalWrite(Rele_1, HIGH);
myBr1 = 0;
}
else
{
Serial.println("Rele 1 OFF the charts - Check what you give me....");
digitalWrite(Rele_1, HIGH);
myBr1 = 0;
}
串行打印给我1回,而不是001
我现在有2个继电器,有点开始OTA更新。将增加更多的继电器。
我混的是什么,我该如何纠正呢?
答案 0 :(得分:0)
对于您的测试,您应该使用引号强制line =“001”为字符串,而不是int。这就是为什么它打印1而不是001
对于line.substring(0) == "1"
的使用,line.substring(0)将返回“001”而不是“1”。正确的方法是line.substring(0,1) == "1"
只能读取第一个字符。
答案 1 :(得分:0)
我了解了&#39; 0&#39;之间的差异。和&#34; 0&#34;今天0。 通过改变:
df_patients['date'] = df_patients['date_of_diagnosis'].apply(lambda x: datetime.datetime.strptime(x, '%Y%m%d'))
要
Original Format Desired Format
3/27/2010 2010-03-27
3/2/2011 2011-03-02
7/20/2009 2009-07-20
这解决了我的问题。