python - SyntaxError:python 中的语法无效(无法运行代码)
问题描述
L = ["hello", "good day", "hi", "see you", "ciao", "au revoir"]
L.insert(0, L.pop())
print (L)
list(map(len, L[2::2])
print (L)
File "<ipython-input-90-36e680b90dd3>", line 5
print (L)
^
SyntaxError: invalid syntax
在运行代码时出现此错误
解决方案
您缺少)
.list(map(len, L[2::2])
它应该是list(map(len, L[2::2]))
推荐阅读
- nestjs - 在保存到嵌套数据库之前执行角色层次结构验证
- css - 使用 animate.css 库进行 nuxt 页面转换
- angular - 在 Ion-List 上显示数据
- reactjs - 下拉菜单中未触发单击事件
- javascript - 正则表达式检查字符串中的 3 个相同字母?
- visual-studio - 在 Visual Studio for Azure Analysis Services 模型中看不到表更新
- snowflake-cloud-data-platform - 您会将哪种类型的雪花连接器用于自动上传新数据的 IoT 数据?
- r - 正在使用哪个 plot()?
- adobe-illustrator - 在 illustrator 中将 pageItem 从一层复制到另一层,没有偏移
- html - 如何将 Bootstrap 卡片放置在另一张具有可滚动内容的卡片下方?