Hi,
I m trying to save the values from the array to the text file in Python. when i give print command to display the array, there is no problem... but when i try to add the values from the array to the text file it is doing nothing..
How to do type casting here..
my code is.
#--code start----------------------------
print 'List values are : ', List[0], List[1],List[2],List[3],List[4]
#--------------------------------------
f=open('temp.txt','w')
f.write(List[0])
f.close()
#--code ends-----------------------------
Note:- I dont know which kind of array is this
So please help me to solve this problem
Regards
Nakul
Comment
Replace
f.write(List[0])
with
f.write(str(List[0]))
Parent comment
Hi, I m trying to save the values from the array to the text file in Python. when i give print command to display the array, there is no problem... but when i try to add the values from the array to the text file it is doing nothing.. How to do type casting here.. my code is. #--code start---------------------------- print 'List values are : ', List[0], List[1],List[2],List[3],List[4] #-------------------------------------- f=open('temp.txt','w') f.write(List[0]) f.close() #--code ends----------------------------- Note:- I dont know which kind of array is this So please help me to solve this problem Regards Nakul