Skip to content

Commit 95b293d

Browse files
authored
Update index.mdx
1. in hello function, update to use f-string for return instead of concatenating strings with plus symbol 2. in POST example, fix dict reference to use key as dicts do not support dot notation by default
1 parent 4a43acf commit 95b293d

File tree

1 file changed

+2
-2
lines changed
  • src/content/docs/workers/languages/python

1 file changed

+2
-2
lines changed

src/content/docs/workers/languages/python/index.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Python workers can be split across multiple files. Let's create a new Python fil
6767

6868
```python
6969
def hello(name):
70-
return "Hello, " + name + "!"
70+
return f"Hello, {name}!"
7171
```
7272

7373
Now, we can modify `src/entry.py` to make use of the new module.
@@ -97,7 +97,7 @@ from workers import Response
9797
from hello import hello
9898

9999
async def on_fetch(request):
100-
name = (await request.json()).name
100+
name = (await request.json())["name"]
101101
return Response(hello(name))
102102
```
103103

0 commit comments

Comments
 (0)