print number of a list line per line - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: print number of a list line per line (/thread-16808.html) |
print number of a list line per line - lateublegende - Mar-15-2019 I have some trouble with my list. I need to print the number line per line. the list looks like that. [16, 1, 1, 3, 6, 5, 87, 4, 83, 0, 2, 7, 86, 54, 32, 78, 45, 21, 23, 41, 35, 76, 90] #the name of the list is yI have tried that y=list(map(int, y)) y=str(y) y=int(y) f = sftp.open("/home/pi/SiteCyberdependance/data/data.txt", "w+") with sftp.open("/home/pi/SiteCyberdependance/data/data.txt", "w") as f: for line in f: sftp=paramiko.SFTPFile.write f.write(y[z]) z=z+1the program write that in my file 16, 1, 1, 3, 6, 5, 87, 4, 83, 0, 2, 7, 86, 54, 32, 78, 45, 21, 23, 41, 35, 76, 90]I need the numbers in my file looks like that. 16 1 1 3 6 5 87 4 83 0 2 7 86 54 32 78 45 21 23 41 35 76 90and I need to increment the number of my choice, I have tried that. g=[1,0,0,0,0,0,0,0,0,0,0,0,0] y=y+g #I do that because y+g don't workits result to add the content of list g at the end of the list y. thank for the help. I know is a lot of stock, but I wanted to explain it well. python 3.7.2 RE: print number of a list line per line - Yoriz - Mar-15-2019 my_list = [16, 1, 1, 3, 6, 5, 87, 4, 83, 0, 2, 7, 86, 54, 32, 78, 45, 21, 23, 41, 35, 76, 90] for item in my_list: print(item)
RE: print number of a list line per line - lateublegende - Mar-20-2019 I have not think to that, is logic. thank for the reply! |