简体   繁体   中英

Python - Error at equals sign for no reason?

I'm using eval and pybrain to make neural networks. Here's it stripped down. Using python 3.6

from pybrain import *

    numnn = 100

    eval("neuralNetwork" + chr(numnn) + " = buildNetwork(2, 3, 1, bias=True)")

eval evaluates expressions. Assignment in Python is not an expression, it's a statement.

But you don't need this anyway. Make a list or dict to hold all of your values.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM