2013-05-29 54 views

回答

2

使用file.truncate

text_file.truncate(0) 

幫助上file.truncate

>>> print file.truncate.__doc__ 
truncate([size]) -> None. Truncate the file to at most size bytes. 

Size defaults to the current file position, as returned by tell(). 
相關問題