0

Here is my code: https://gist.github.com/a97f6c4eb5a834f2c99fe9e5f1e919ee Getting this error message: AttributeError: 'dict' object has no attribute 'startswith'

Anywhere I can understand better syntax for transferring variables from python to SQL/html?

1 Answer 1

0

I think that your issue is how you've used the lookup function. Look in "helpers.py" to see how the lookup function is defined. The first row of code includes a 'startswith'. Your error message occurs at the first point when you try and use the lookup function.

Consider how your code is trying to access the 'dict' via the lookup function. It is not picking up the data because you are using lookup(symbol[0]) and it is not finding anything at '[0]' because the symbol is referenced in the dict as a 'str' (string).

This link provides a good overview of how a 'dict' works: https://learnpythonthehardway.org/book/ex39.html

1
  • thanks I have been having trouble with this syntax..I will read the documentation that you pointed to.
    – cfdphd
    Mar 12, 2017 at 0:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .