python - 使用第一个程序在 python 中获取语法错误
问题描述
所以,我刚刚开始尝试学习 Python,我正在关注一本名为:Automate the Boring Stuff with Python的“书” 。我正在做书中的第一个程序,我认为一切都很好......但现在我遇到了一个错误,我无法弄清楚为什么。
# This Program says hello and ask for my name.
print('Hello world!')
print('What is your name?') # ask fo their name
myName = input()
print('It is good to meet you, ' + myName)
print('The length of your name is:')
print(len(myName)
print('What is your age?') # ask for thier age
myAge = input()
print('You will be ' +str(int(myAge) + 1) + ' in a year.')
VS Code 从第 9 行开始显示错误,但我终其一生都无法弄清楚。任何帮助将不胜感激。
谢谢。
解决方案
print(len(myName)
失踪 ')'。
推荐阅读
- python - Python 在 if 语句中使用正则表达式匹配对象,然后访问像 Perl 这样的捕获组
- sockets - TCP 套接字:传输层可以访问网络层标头吗?
- performance - 物理上更靠近 CPU 的内存会比物理上更远的内存执行得更快吗?
- python-3.x - 如何替换字符串中的字符串但将字符串保留在括号中,就像它在python中一样?
- javascript - 如何在 Cytoscape.js 中制作加权图?
- kubernetes - readinessProbe 似乎没有等待初始延迟
- encryption - 加密 emacs 组织模式文件
- r - 在 kable 列上添加渐变色标
- swift - iOS 14 奇数指针跳转,按位运算导致崩溃
- java - 打印出 for 循环中的数字