python - Displaying a list as string -
i pretty new python, , writing code program queries , displays map image id's satellite images.
the images compiled list, , print list string, new lines between each image id. image id's saved separate entries in list, when try
print result list_ = result list_as_json = json.dumps(list_) mybigstring = "\n".join(list_as_json) print mybigstring
or
mybigstring = "" s in list_as_json: mybigstring = mybigstring + "\n" + s print mybigstring
it ends printing every letter id on different line. so, instead of printing like:
landsat/le7_l1t/le70160402014017edc00
landsat/le7_l1t/le70160402014033edc00
landsat/le7_l1t/le70160402014049edc00
landsat/le7_l1t/le70160412014017edc00
landsat/le7_l1t/le70160412014033edc00
landsat/le7_l1t/le70160412014049edc00
it prints:
l
n
d
s
t
/
l
e
7
_
l
1
etc.
if enter
print list_as_json
i get:
["landsat/le7_l1t/le70160402014017edc00", "landsat/le7_l1t/le70160402014033edc00", "landsat/le7_l1t/le70160402014049edc00", "landsat/le7_l1t/le70160412014017edc00", "landsat/le7_l1t/le70160412014033edc00", "landsat/le7_l1t/le70160412014049edc00"]
any words of wisdom?
your python script works correct - have string
, not list
, iterates on chars
show how create list
variable more concrete
you can try split string list , print way do
Comments
Post a Comment