How do you use open() with appending mode AND seek() in Python on Linux? -


I have the following:

  opened as a log (file, 'A' ): # A bunch of code, some of them write to log in. Logs. Seek (0) logs. Written (Time.StrafTime (T-Format))  

() does not work with attachment, and if I use 'W', then the beginning file In the overwritten docs it says, "... 'A' ending (which is on some Unix system, it means that all write, note the status of the current search along with the end of the file)" < / P>

Is anyone on the other side to argue the snake from the end of the file Q allows:

/ P>

  with open (file name , 'W') as log: log.seek (0, 0) log .write (time.strtftime (t_format))  

You need to type logging of Python's logging module Should also be used to consider.


Comments

Popular posts from this blog

c# - SignalR: "Protocol error: Unknown transport." when navigating to hub -

c# - WPF Expander overlay used in ItemsControl -

class - Kivy: how to instantiate a dynamic classes in python -