Как получить доступ к возвращаемым значениям из одной функции в другую, используя python3?Я не могу передать функцию возврата из одной функции в другую?Я новичок в программировании, пожалуйста, помогите мне
import os
import sys
import pytesseract
from PIL import Image
from pdf2image import convert_from_path
filename = "C:\\Users\\subashini.u\\Desktop\\tesseract-python\\penang_40.2.pdf"
def tesseract(filename):
PDF_file = filename
pages = convert_from_path(PDF_file, 500)
image_counter = 1
for page in pages:
filename = "page_"+str(image_counter)+".jpg"
page.save(filename, 'JPEG')
image_counter = image_counter + 1
filelimit = image_counter-1
outfile = "C:\\Users\\subashini.u\\Desktop\\tesseract-python\\text_file.txt"
f = open(outfile, "a",encoding = "utf-8")
for i in range(1, filelimit + 1):
filename = "page_"+str(i)+".jpg"
text = str(((pytesseract.image_to_string(Image.open(filename)))))
text = text.replace('-\n', '')
#print(text)
f.write(text)
f.close()
f1 = open(outfile, "r",encoding = "utf-8")
input_file = f1.readlines()
return input_file
def a(input_file):
for i in input_file: # i want to acess the return value here
print(i)
a(input_file)