-3
ascii85.encode(file('/work/file1'), sys.write('/work/file2')  

I am trying to write to a file with this code using sys.stdout, but it is not writing.

How do I fix the code to write to a file?

Brian Webster
  • 30,033
  • 48
  • 152
  • 225
sophanox
  • 39
  • 1
  • 1
  • 3
  • 2
    Please read the line of code and try to understand what it is doing before asking a question. – Ignacio Vazquez-Abrams Aug 02 '11 at 21:26
  • i'm just trying to do it in the python shell. It works if i use: ascii85.encode(file('/work/file1'), sys.stdout but it obviously prints to the screen which i don't want – sophanox Aug 02 '11 at 21:28

1 Answers1

2

Try

ascii85.encode(file('/work/file1'), open('/work/file2', 'w'))

I don't know what exactly you're trying to do but that's how you open a file for writing in Python.

If this isn't what you want please clarify your question.

agf
  • 171,228
  • 44
  • 289
  • 238