variable ne prends pas la valeur
Bonjour,
Je ne comprends pas pourquoi ma variable reste a valeur chaine nulle = ''
voici la partie du code, d'après une fonction de tyrtanos que j'ai adapté
sk_path a la bonne valeur mais les conditions pour les valeurs de la variable intitule_value_start prends la valeur nulle dans tout les cas.
la variable est de type unicode au lieu de str ??
BON j'ai trouvé ,j'ai mis == au lieu de = pour la variable
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
root_path = "SYSTEM/CurrentControlSet/services"
dict_values, list_subkeys = dump_subkey(root_path)
nb_items = None
# init var
intitule_value_start = ''
for subkey in list_subkeys[:nb_items]:
sk_path = build_path(root_path, subkey)
d_values, l_subkeys = dump_subkey(sk_path)
if sk_path == 'SYSTEM\CurrentControlSet\services\BFE' or sk_path == 'SYSTEM\CurrentControlSet\services\wuauserv' or sk_path == 'SYSTEM\CurrentControlSet\services\MpsSvc'\
or sk_path == 'SYSTEM\CurrentControlSet\services\BITS':
if 'ErrorControl' in d_values or \
'Start' in d_values or \
'Description' in d_values or \
'Type' in d_values :
for x in d_values:
if sk_path == 'SYSTEM\CurrentControlSet\services\wuauserv':
intitule_value_start == 'Windows Update .................................'
if sk_path == 'SYSTEM\CurrentControlSet\services\BFE':
intitule_value_start == 'Moteur de filtrage de base .....................'
if sk_path == 'SYSTEM\CurrentControlSet\services\MpsSvc':
intitule_value_start == 'Windows parefeu ................................'
if sk_path == 'SYSTEM\CurrentControlSet\services\BITS':
intitule_value_start == 'Service de transfert intelligent en arriere plan'
if x == 'Description':
fichier.write(unicode("{0}".format(intitule_value_start).encode("utf-8")))
if x == 'ErrorControl':
fichier.write(unicode("< "+x+" > : {0} ".format(d_values[x])).encode("utf-8"))
if x == 'Start':
fichier.write(unicode("< "+x+" > : {0} ".format(d_values[x])).encode("utf-8"))
if x == 'Type':
fichier.write(unicode('< '+x+' > : {0} '.format(d_values[x])+'\n\r').encode("utf-8"))
fichier.write(unicode("=" * 120+'\n\r').encode("utf-8"))
# end for
fichier.close()
return |