Writes the specified content text (second argument) to the specified file name (first argument). The file name may be a list, in which case the elements are concatenated using the os.path.join() method. The file is created under the temporary working directory. Any
(self, file, content, mode='wb')
| 571 | pass # Ignore any problems changing modes. |
| 572 | |
| 573 | def write(self, file, content, mode='wb'): |
| 574 | """ |
| 575 | Writes the specified content text (second argument) to the specified |
| 576 | file name (first argument). The file name may be a list, in which case |
| 577 | the elements are concatenated using the os.path.join() method. The file |
| 578 | is created under the temporary working directory. Any subdirectories in |
| 579 | the path must already exist. The I/O mode for the file may be specified |
| 580 | and must begin with a 'w'. The default is 'wb' (binary write). |
| 581 | |
| 582 | """ |
| 583 | if type(file) is ListType: |
| 584 | file = apply(os.path.join, tuple(file)) |
| 585 | if not os.path.isabs(file): |
| 586 | file = os.path.join(self.workdir, file) |
| 587 | if mode[0] != 'w': |
| 588 | raise ValueError, "mode must begin with 'w'" |
| 589 | open(file, mode).write(content) |
no outgoing calls
no test coverage detected