list to string

John J. Lee jjl at pobox.com
Thu Sep 11 19:12:48 EDT 2003


Graham Nicholls <graham at rockcons.co.uk> writes:

> main (args):
>         fhand=open(args[1:],"r+")
> 
> and get an error that open is expecting a string not a list.
[...]

If args is sys.argv, then yup, that's a list.  print is your friend:

main (args):
        print args[1:]
        sys.exit()
        fhand=open(args[1:],"r+")


John




More information about the Python-list mailing list