-1

I'm trying to do a simple function to delete some cache files. But I'm getting an syntax error, and I dont know why...

Code:

import xml.etree.ElementTree as ET
import os
import filecmp
import urllib
import shutil

def clean ():
    shutil.rmtree('/apks')
    os.remove('apk_cache')
    os.remove('info.xml')
    os.makedirs('apks')
    print "Cache - Clear"

    return menu ()

Error:

 File "C:\Users\Joao Carreira\ownCloud\Development\Python\Aptoide_Utils\utils.p
", line 14
   print "Cache - Clear"
                       ^

Thanks for the help! :)

jdicarreira
  • 159
  • 2
  • 13

1 Answers1

0

If you use Python 3.x, you should write it as follow:

print("Cache - Clear")

print is a function in Python 3.x.


>>> print "Cache - Clear"
  File "<stdin>", line 1
    print "Cache - Clear"
                        ^
SyntaxError: invalid syntax
>>> print("Cache - Clear")
Cache - Clear
>>> print
<built-in function print>
falsetru
  • 357,413
  • 63
  • 732
  • 636