(filename, contents)
Create a file with the specified name and write 'contents' (a
    sequence of strings without line terminators) to it.
Create a file with the specified name and write 'contents' (a
    sequence of strings without line terminators) to it.
Create a file with the specified name and write contents ( a sequence of strings without line terminators ) to it .
def write_file(filename, contents):
    """Create a file with the specified name and write 'contents' (a
    sequence of strings without line terminators) to it.
    """
    contents = "\n".join(contents)

    # assuming the contents has been vetted for utf-8 encoding
    contents = contents.encode("utf-8")

    with open(filename, "wb") as f:  # always write POSIX-style manifest
        f.write(contents)
def write_file ( filename , contents ) : contents = "\n" . join ( contents ) # assuming the contents has been vetted for utf-8 encoding contents = contents . encode ( "utf-8" ) with open ( filename , "wb" ) as f : # always write POSIX-style manifest f . write ( contents )