我正在尝试执行一个简单的功能来删除一些缓存文件。 但我遇到了语法错误,我不知道为什么......
代码:
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 ()
错误:
File "C:\Users\Joao Carreira\ownCloud\Development\Python\Aptoide_Utils\utils.p
", line 14
print "Cache - Clear"
^
感谢您的帮助! :)
如果你使用Python 3.x,你应该这样写:
print("Cache - Clear")
print
是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>