File "D:\Project\Test01.py", line 5 print(name string[5]) ^^^^^^^^^^^^^^ SyntaxError: invalid syntax. Perhaps you forgot a comma?
时间: 2023-08-01 15:13:05 浏览: 52
这个报错提示是因为在第5行的代码中,`name`和`string[5]`之间缺少了一个逗号。在 Python 中,如果你想要在 `print()` 函数中输出多个变量,则需要用逗号将它们分隔开,如下所示:
```python
print(name, string[5])
```
这样就能够正常输出了。
相关推荐
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)