我写一个Python代码,我试图找出哪些功能将是最好的执行以下任务计数行的列数:如何与Python
我想说“如果字的行数不等于1,做的东西”
#Some code
words = line.split("\t")
if sum(words) != 1
#Do something
#Some code
words = line.split("\t")
if int(words) != 1
#Do something
#Some code
words = line.split("\t")
if len(words) != 1
#Do something
所有这些命令返回以下错误:
File "test.py", line 10
if len(words) != 1
^
SyntaxError: invalid syntax
谁能帮助?
...你错过了结肠。 – jonrsharpe
'len'应该做 – Noxeus