Yahoo Clever wird am 4. Mai 2021 (Eastern Time, Zeitzone US-Ostküste) eingestellt. Ab dem 20. April 2021 (Eastern Time) ist die Website von Yahoo Clever nur noch im reinen Lesemodus verfügbar. Andere Yahoo Produkte oder Dienste oder Ihr Yahoo Account sind von diesen Änderungen nicht betroffen. Auf dieser Hilfeseite finden Sie weitere Informationen zur Einstellung von Yahoo Clever und dazu, wie Sie Ihre Daten herunterladen.
Python question. Syntax error?
I'm new to Python and I have an example script that has a syntax error, but I can't see what's wrong. Here it is:
class SimpleGraph:
def __init__(self):
self._spo = {}
self._pos = {}
self._osp = {}
def add(self, (sub, pred, obj)):
I get a syntax error on the ( before sub. I'm running Python 3.1. Any ideas?
1 Antwort
- SilentLv 7vor 1 JahrzehntBeste Antwort
Why do you have parentheses around the last three parameters to the add function?
If you're trying to make the function take a tuple as a parameter, you can't do it that way in Python 3. That was possible in previous versions of Python, but not anymore.
Python 3 and Python 2 are not compatible languages. If you're running Python 3, don't use example code written for Python 2; you'll just end up with a lot of confusion and things that don't work.