0

I installed python on a machine in digital ocean and cloned a repository with a file that was running on my local machine. But when I went to run the terminal by digital ocean he gave that error.

  File "teste.py", line 37
    print 'Total de marcas encontradas: '+str(len(all_brands)) 
                                        ^
SyntaxError: invalid syntax

2 Answers2

0

The following statement is only valid in Python 2:

print 'Total de marcas encontradas: '+str(len(all_brands))

With Python 3, print is a function, you need to add parenthesis:

print('Total de marcas encontradas: ' + str(len(all_brands)))
Laurent LAPORTE
  • 21,958
  • 6
  • 58
  • 103
0

You apparently switched to Python3.

$ python2
>>> print 'Hello' + str (len ('there'))
Hello5

$ python3
>>> print 'Hello' + str (len ('there'))
  File "<stdin>", line 1
    print 'Hello' + str (len ('there'))
                ^
SyntaxError: invalid syntax
maxpolk
  • 2,167
  • 1
  • 18
  • 24