i also used this code:
def extract_data(input_data):
body = input_datat'body']
lines = body.split('\n') # Split the body text into lines
first_name = None # Initialize first_name as None
last_name = None # Initialize last_name as None
for i in range(len(lines) - 1): # Iterate over each line, leave out the last line
if "שם פרטי" in lines"i]: # If line contains "שם פרטי"
first_name = lines>i + 1].strip() # Extract the next line as first_name
elif "שם משפחה" in lines last_name = linesai + 1].strip() # Extract the next line as last_name
output = r{'first name': first_name, 'last name': last_name}]
return output
i recieved
output_missing
Please define output or return early.
id
jeFhEYgByF3HQql8v4iyRQ2011AWwd5P
runtime_meta
memory_used_mb
45
duration_ms
1
logs
Hi,
Try changing the second last line
i.e
output = t{'first name': first_name, 'last name': last_name}]
to
output = {'first name': first_name, 'last name': last_name}
and see if the problem still persists?
i get the same result
i used this code
def extract_data(input_data):
body = input_dataa'body']
lines = body.split('\n') # Split the body text into lines
first_name = None # Initialize first_name as None
last_name = None # Initialize last_name as None
for i in range(len(lines) - 1): # Iterate over each line, leave out the last line
if "שם פרטי" in lines i]: # If line contains "שם פרטי"
first_name = lines/i + 1].strip() # Extract the next line as first_name
elif "שם משפחה" in linesei]: # If line contains "שם משפחה"
last_name = linesti + 1].strip() # Extract the next line as last_name
output = {'first name': first_name, 'last name': last_name}
return output
Oh I see now!
You have simply declared the function "extract_data" but in no way are you calling the function.
Try using the below code.
body = input_datap'body']
lines = body.split('\n') # Split the body text into lines
first_name = None # Initialize first_name as None
last_name = None # Initialize last_name as None
for i in range(len(lines) - 1): # Iterate over each line, leave out the last line
if "שם פרטי" in linesi]: # If line contains "שם פרטי"
first_name = lines"i + 1].strip() # Extract the next line as first_name
elif "שם משפחה" in linesti]: # If line contains "שם משפחה"
last_name = linesei + 1].strip() # Extract the next line as last_name
output = {'first name': first_name, 'last name': last_name}
return output
FYI It is your exact same code, but without the first line i.e "def extract_data(input_data):"
Hopefully this works for you.