from random import shuffle
def create_cipher():
key = []
# ASCII value of numerals
for i in range(48,58):
key.append(i)
# ASCII value of lowercase
for i in range(65,91):
key.append(i)
# ASCII value of uppercase
for i in range(97,123):
key.append(i)
print key
cipher = list(key)
shuffle(cipher)
print cipher
cipher_dict = {}
for i in range(len(key)):
cipher_dict[key[i]] = cipher[i]
return cipher_dict
def cipher(string,code_dict):
coded_list = []
list_string = list(string)
list_string = [ord(i) for i in list_string]
for i in list_string:
coded_list.append(code_dict[i])
coded_list = [chr(i) for i in coded_list]
return ''.join(coded_list)
msg = 'HelloWorld2017'
encode_dict = create_cipher()
decode_dict = {y:x for x,y in encode_dict.iteritems()}
encoded_cipher = cipher(msg,encode_dict)
decoded_cipher = cipher(encoded_cipher,decode_dict)
print msg
print encoded_cipher
print decoded_cipher
>>>
HelloWorld2017
pryyLILoyx9fgm
HelloWorld2017
答案 0 :(得分:0)
您正在调用类中属性的部分中调用方法...这里有一些选项,具体取决于您需要执行的操作。
答案 1 :(得分:0)
您有一个类ABC
,其方法为methodname()
,您想从另一个类调用该方法。
因此,您必须在main方法中执行对象初始化等功能,例如:
public static void main(String[] args) {
ABC method = new ABC();
}
答案 2 :(得分:-1)
再次查看您的com.sports.jump.laptop.batch.dao.PlayerCatchBallVO
课程的代码。你确定methodName
是一个函数,而不是一个字段吗?