'time data '-f' does not match format '%d%m%y%H%M%S' jupyter

I can't see the problem .I'm running the same code in pythob and it helps but in notebook it's full of errors i'm not understanding.Please ifi someone can help me.

import pandas as pd
import csv                       
import datetime as dt    
import sys                     


position = 0                  

valeur = sys.argv[1]            

valeurFormatee = dt.datetime.strptime(valeur,'%d%m%Y%H%M%S').strftime("%d%m%Y%H") 
formatted_date1 = dt.datetime.strptime(valeurFormatee,'%d%m%Y%H') 

with open('prevision.csv', 'r') as csvSource  
csvReader =  csv.reader(csvSource)        

for idx, line in enumerate(csvReader):   

    idt = dt.datetime.strptime(line[0], '%Y-%m-%d %H:%M:%S').strftime("%d%m%Y%H")
    formatted_date2 = dt.datetime.strptime(idt, '%d%m%Y%H') 
    
    if   formatted_date2 == formatted_date1: 
        position = idx            
        
with open('prevision.csv', 'r') as csvSource1  
csvReader1 =  csv.reader(csvSource1)     

row = list(csvReader1) 


j1 = position - 24              
j2 = position - 48              
j3 = position  - 72         
j7 = position  - 168          

print ("    ")
print ("resultat de la recherche de la date : " + dt.datetime.strptime(valeur, '%d%m%Y%H%M%S').strftime("%d/%m/%Y %H") )
print ("Resultat trovée a la position " + str(position) + " dans le fichier prevision.csv")
print ("    ")

data0 = ['valeur de rechrche','',position]  
data0[1] = dt.datetime.strptime(valeur, '%d%m%Y%H%M%S').strftime("%d-%m-%Y:%H") 
    
print ("=========>resultat de -1j ")
print ("    la date -1j est " + row[j1][0])
print ("    la temperature -1j est " + row[j1][1])
print ("    l'enrgie -1j est " + row[j1][2])
print ("    ")

data1 =  row[j1] 
    
print ("=========>resultat de -2j ")
print ("    la date -2j est " + row[j2][0])
print ("    la temperature -2j est " + row[j2][1])
print ("    l'enrgie -2j est " + row[j2][2])
print ("    ")

data2 =  row[j2] 

    
print ("=========>resultat de -3j ")
print ("    la date -3j est " + row[j3][0])
print ("    la temperature -3j est " + row[j3][1])
print ("    l'enrgie -3j est " + row[j3][2])
print ("    ")

data3=  row[j3] 

    
print ("=========>resultat de -7j ")
print ("    la date -7j est " + row[j7][0])
print ("    la temperature -7j est " + row[j7][1])
print ("    l'enrgie -7j est " + row[j7][2])
print ("    ")

data4=  row[j7] 


outputFileName = dt.datetime.strptime(valeur, '%d%m%Y%H%M%S').strftime("%d%m%Y%H%M%S") 

output = open(outputFileName+'.csv', 'w')    
writer = csv.writer(output)             

writer.writerow(data0) 
writer.writerow(data1) 
writer.writerow(data2) 
writer.writerow(data3) 
writer.writerow(data4) 

        
print ("resultat sauvgardée au format csv au fichier " + outputFileName + ".csv")


`**ValueError`                                Traceback (most recent call last)**

---> 12 valeurFormatee = dt.datetime.strptime(valeur,'%d%m%y%H%M%S').strftime("%d%m%Y%H")

ValueError: time data '-f' does not match format '%d%m%y%H%M%S'



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source