- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
关注此tutorial我在 y = 1 处收到以下错误;我正在为 Python 使用 Netbeans 6.5。谢谢
y=1
^
SyntaxError: line 8:3 mismatched input '' expecting DEDENT (temperatureconverter.py, line 8)
以下是python代码,帮我格式化一下谢谢
__author__="n"
__date__ ="$Jan 9, 2011 3:03:39 AM$"
def temp():
print "Welcome to the NetBeans Temperature Converter."
y=1
n=0
z=input("Press 1 to convert Fahrenheit to Celsius, 2 to convert Celsius to Fahrenheit, or 3 to quit:")
if z!=1 and z!=2 and z!=3:
e=input("Invalid input, try again?(y or n)")
if e==1:
t=''
temp()
if e==0:
t="Thank you for using the NetBeans Temperature Converter."
print "Celsius Fahrenheit" # This is the table header.
for celsius in range(0,101,10): # Range of temperatures from 0-101 in increments of 10
fahrenheit = (9.0/5.0) * celsius +32 # The conversion
print celsius, " ", fahrenheit # a table row
temp()
最佳答案
在 print
语句中,您使用了 2 个空格来缩进该行,而在下一个语句中,您放置了 3 个空格。
空格在 Python 中很重要。具体来说,如果您在一行中有一定程度的缩进,则不能只在下一行使用另一个缩进。
关于python - 错误 "mismatched input"期待 DEDENT,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4639556/
https://docs.python.org/3/reference/compound_stmts.html#grammar-token-suite suite ::= stmt_list NEWL
我们愿意/被迫为大学开发一个小型网络应用程序。现在我们开始了,一切似乎都很好,直到出现上述奇怪的错误。 Statement expected, found py: Dedent 该错误由以下代码行引发
我正在阅读关于 lexical analysis of python 的文档,其中描述了如何生成 INDENT 和 DEDENT token 的类(class)。我在此处发布了描述。 The inde
我正在 AnTLR4 中实现 Python 语法,但我面临着与此处讨论的 INDENT 和 DEDENT 相同的问题:ANTLR4- dynamically inject token 我正在尝试的解决
关注此tutorial我在 y = 1 处收到以下错误;我正在为 Python 使用 Netbeans 6.5。谢谢 y=1 ^ SyntaxError: line 8:3 m
我正在尝试在 basemap 叠加层上绘制网络。 我有包裹: basemap =1.3.0=py36ha7665c8_0 matplotlib=3.3.1=0 matplotlib-base=3.3.
当我在 Python 中使用三引号多行字符串时,我倾向于使用 textwrap.dedent 来保持代码的可读性和良好的缩进: some_string = textwrap.dedent("""
我在 bash 中有一个包含多行字符串的变量: mystring="foo bar stack overflow" 显然,当我 echo "
我在 bash 中有一个包含多行字符串的变量: mystring="foo bar stack overflow" 显然,当我 echo "
我试图将 Goes-16 Netcdf 文件投影到 basemap 中,但每次都遇到相同的错误。我试过将 python 从 3.7.3 降级到 3.6,更新和降级 basemap ,但我找不到任何关于
我是一名优秀的程序员,十分优秀!