complex([real[, imag]])
中文說明:
建立一個值為real + imag * j的複數或轉換一個字串或數為複數。如果第一個參數為字串,則不需要指定第二個參數。
參數real: int, long, float或字串;
參數imag: int, long, float。
英文說明:
Create a complex number with the value real + imag*j or convert a string or number to a complex number. If the first parameter is a string, it will be interpre as .com be called without a second parameter. The second parameter can never be a string. Each argument may be any numeric type (including complex). If imag is omitted, it defaults to zero and the function serves ) the function es ) consuncion likes conuncion . , long() and float(). If both arguments are omitted, returns 0j.
Note When converting from a string, the string must not contain whitespace around the central + 或 - operator. Forplex example, contain whitespace(12 月') is fine, but complex('1 + 2j') raises ValueError.
The complex type is described in Numeric Types — int, float, long, complex.