Hello 
i try to create a script to convert a date "YYYYmmddHHMMSS" as an UNIX 
timestamp. This is an example of my log file 
cat /tmp/test.log201106121122332011012614553520110126185500
here is my code: 
#! /usr/bin/python
import osimport sysimport globimport reimport time
dir_log = "/tmp"#loop to find files log in a directoryfor log_files_in  in 
glob.glob(os.path.join(dir_log, '*.log') ):        #print log_files        
file_brut = open(log_files_in, 'r')        line_log = file_brut.readline()      
  while line_log:                
timestamp=int(time.mktime(time.strptime(line_log, "%Y%m%d%H%M%S")))             
   line_log=file_brut.readline()                print timestamp

And here the error code: 
Traceback (most recent call last):  File "formatage_lms.py", line 32, in ?    
timestamp=int(time.mktime(time.strptime(line_cdr, "%Y%m%d%H%M%S")))  File 
"/usr/lib64/python2.4/_strptime.py", line 296, in strptime    raise 
ValueError("unconverted data remains: %s" %ValueError: unconverted data remains:

I don't know what i'm diong wrong please could you help me
RegardsMiguel

                                          
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to