I want to save a list of strings in the python array. My code is as follows:
import os Images_list = [os.listdir ("/ home / metal-machine / pictures / new")] print image_list [0]
It only prints the list in [0] and when I use
print image_list [1]
then it Returns the error: index error: index list outside the range
I'm sure this is "out of range" index because all the elements in the list are not separated by commas
< P> For this Can I also use the partition method in Python? images_list.split ()
and divides the above command files, but a comma is inserted between them, but why not Python By default, insert a comma in the middle of all the elements? Is the list of Python types valid in Python?
Why not write code which is a bit more error
Images_list For images in: Print images
No comments:
Post a Comment