How to a turn a list of strings into complex numbers in python?

前端 未结 5 773
刺人心
刺人心 2021-01-19 19:33

I\'m trying to write code which imports and exports lists of complex numbers in Python. So far I\'m attempting this using the csv module. I\'ve exported the data to a file u

5条回答
  •  野性不改
    2021-01-19 20:23

    >>> c = ['(37470-880j)','(35093-791j)','(33920-981j)']
    >>> map(complex, c)
    [(37470-880j), (35093-791j), (33920-981j)]
    

提交回复
热议问题