简体   繁体   中英

INT to STRING conversion in python

I am unable convert int to string using str() . Everywhere on internet I found str() used to convert int to string .

I tried to run this on jupyter notebook

My Code:

num=23
string=str(num)

Error:

TypeError  Traceback (most recent call last)
ipython-input-24-63bcf2e7ab44> in <module>
       1 num=23
 ----> 2 string=str(num)
TypeError: 'str' object is not callable

Somewhere earlier on, you did:

str = 'somestr goes here'

Never name a variable str ; it causes this problem. You can correct it for now with:

del str

but the solution in the future is to never use str as a variable name.

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