Ask me I want to have a string of number according to the dictionary dic to replace, why can't write the correct replacement? 0 should correspond to 9, 1 corresponding to 0, for example,...... According to write wrong, for, so where I went wrong?
CodePudding user response:
refer to the building after a moment's reply: ask me I want to have a string of number according to the dictionary dic to replace, why can't write correct replacement? 0 should correspond to 9, 1 corresponding to 0, for example,...... According to write wrong, for, so where I went wrong? For the key in dic_1 this sentence to take out the key value is the value of the dictionary, rather than a dictionary key, to take out the key For the key in dic_1. Keys () CodePudding user response:
reference 1st floor Hajo_ response: Quote: refer to the building after a moment's reply: ask me I want to have a string of number according to the dictionary dic to replace, why can't write the correct replacement? 0 should correspond to 9, 1 corresponding to 0, for example,...... According to write wrong, for, so where I went wrong? For the key in dic_1 this sentence to take out the key value is the value of the dictionary, rather than a dictionary key, to take out the key For the key in dic_1. Keys () Or not, CodePudding user response:
refer to the second floor after a moment's reply: Quote: refer to 1st floor Hajo_ response: Quote: refer to the building after a moment's reply: ask me I want to have a string of number according to the dictionary dic to replace, why can't write the correct replacement? 0 should correspond to 9, 1 corresponding to 0, for example,...... According to write wrong, for, so where I went wrong? For the key in dic_1 this sentence to take out the key value is the value of the dictionary, rather than a dictionary key, to take out the key For the key in dic_1. Keys () Still not ah, Is taken from the dictionary, you value, the value of the dictionary is not a dictionary key, lead to replace the key variable is not point to you want to replace CodePudding user response:
refer to the second floor after a moment's reply: Quote: refer to 1st floor Hajo_ response: Quote: refer to the building after a moment's reply: ask me I want to have a string of number according to the dictionary dic to replace, why can't write the correct replacement? 0 should correspond to 9, 1 corresponding to 0, for example,...... According to write wrong, for, so where I went wrong? For the key in dic_1 this sentence to take out the key value is the value of the dictionary, rather than a dictionary key, to take out the key For the key in dic_1. Keys () Still not ah, And, why want to traverse the value of the dictionary, as long as you determine the number of the string in the dictionary is just to replace it