On 19/08/12 02:17, vickistan wrote:
Hello: I am trying to output an array to another program that takes an array
as input
You are printing a list. You are not passing an 'array' to anything.
What exavctly does the other program expect to see. An array object - as
defined in what language? or a list of strings? or something else.
the print statement adds a newline.
It also prints the string representation of your list.
If you want to print the contents of the list use a loop:
for item in arrayname: print item
That will give you the items each on a separate line but without the []
If you want it on a single line add a comma:
for item in arrayname: print item, # python 2, python 3 is different
And if you don't want spaces use join():
print ''.join(arrayname)
of the array. Is there another way to print an array besides
print arrayname
See above. but without knowing what your other program expect an 'array'
to look like we can't say what is best.
output as an array. Each element is a url. I call it from a browser, and it
works except for the added newline.
That suggests that you might actually want to create an html document?
If you need a file its best to create a file rather than rely on print
statements. IMHO...
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor