简体   繁体   中英

How to declare a variable in Python without assigning a value to it like MATLAB?

我想计算Python中的 不确定积分 ...所以如何在不给变量赋值的情况下获取变量...

You could use value = None . More information can be found in this related SO post.

It would helpful if we could see an example of exactly what you are trying to do so we could help your problem specifically.

Because python is not like C or java or so, when you declare a new variable you don't have to indicate the type explicitly. Thus you can't leave a blank after the variable name to make it valueless.
For python a wise way to do so is to actually assign a ' noun ' value to it.

variable_name = None

您可以像这样设置变量而不给它赋值:

variable = []

在Python中使用Sympy库。

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