Mar-21-2019, 09:10 PM
(Mar-21-2019, 02:06 PM)lateublegende Wrote: I try to write my list, but I need len() for write it.Most be
if I write in str, they print 5 item.
str
to write paramiko doc.Example if have list with integers,need to convent fourth and back to original list.
lst = [1, 2, 3 ,4] # Most be string befor write lst = ','.join(str(i) for i in lst) with open('test.dat', 'w') as f: f.write(lst) with open('test.dat') as f: lst = f.read().split(',') lst = [int(i) for i in lst] print(lst)
Output:[1, 2, 3, 4]