list to string
Gonçalo Rodrigues
op73418 at mail.telepac.pt
Thu Sep 11 18:25:25 EDT 2003
On Thu, 11 Sep 2003 23:07:38 +0100, Graham Nicholls
<graham at rockcons.co.uk> wrote:
>Hi. Sorry if this is really dim, but I'm trying to do something like:
>
>main (args):
> fhand=open(args[1:],"r+")
>
args[1:] is a slice. So if args is a list, args[1:] is a list, if it's
a string, it's a string, etc... open expects a string -- as you
probably have already figured out.
>and get an error that open is expecting a string not a list.
>
So either you are passing the wrong argument: e.g. a list instead of a
string, or then, if you do want to pass a list then you have to change
your code. But now the course to follow depends on what you want to
do. So you have to explain a little more.
With my best regards,
G. Rodrigues
More information about the Python-list
mailing list