write a lumbda function to formate a name by python
时间: 2024-05-10 17:16:34 浏览: 127
将字符串转换成lumbda
Here's an example of a Lambda function written in Python that formats a name:
```
import json
def lambda_handler(event, context):
first_name = event['first_name'].capitalize()
last_name = event['last_name'].capitalize()
full_name = f"{first_name} {last_name}"
return {
'statusCode': 200,
'body': json.dumps(full_name)
}
```
This function takes in two parameters, `first_name` and `last_name`, which are passed in as part of an event object. It then capitalizes the first letter of each name and combines them into a full name. Finally, the function returns the formatted name as a JSON object with a status code of 200.
阅读全文