这是我的代码
data = {"act":"login","class":"profile","prftcf":"%s"%(code1),"p":"%s"%(password1),"u":"%s"%(username1),"ver":"0.9.1"}
password1
和username1
%s
工作正常且password1
和username1
为raw_input
。
我的变量code1
是一个字符串:
code1 = "OTcwMzAzY2NjY2NjY2NjY6eZwkOnclZLYgFCeIDITYbkoKNqeZFIOLYr97sRo5GNGwqpSh7RqlUn\nnsfJTFGCMhheFN+AiHzAxhFIq28T8k7wePciHu53gErQPsOKwoXe57To2QhNTsn3RBnqTuGlwvvT\nW32JYeZX4EfCBW3sDdb4l5ibCojZ+eenW2DnvF9UdW6u8H1Udc9e0WD/ZgyIJ73wisKezo58vuTS\nDhG8Ti9FIU6DhUw9PX2YsDuFSlUgfbcKA/u77/R1Qnzhoo+c3FTMymf6rd7Pvs3W5N7vRkd5sktT\ngTrsOXPvIE7Gk1JWgxsug4V9RGEkf8+M0LXW8Ykj9O5GPbz168Yl+UvCv+eQHGfq+zFs2G0vTDAk\no3LUupYwo6y+/EDSkulRJFxEaj88spNcIS3bsIvalXRoPfUZdCyT0flmekEOAu+Wvgts4XKVl8CT\nLr5BEOX2vAgwhttMRpsmbJ1vUlySzH2FcD1IG7a//yJCO1mF5wmwEQWiLEcb+uWRC0MIuw2NxuyE\nZN71TedMPqzesyg7Y/5aS5yd2PIslBiCiFhmSVkG6arSnf+LoKKJ8Tm6gJwaDgl5WMrtkzURpzuR\nzbx/reP5P24Kk9URgnO3iecvXp4O9ZWvS7knDAsMYXyHbsNwKDQujgK6vtNyOYpGiFFuf4mJggNR\nfhtRr/e4m/J07lIf1tCOB6r9sY/EbaA5k6wjs7UT1lTV/FAiKvSlDFE07voPcaGPyfZISzKKZXfr\nYeVmugGm86o8p+N019vB2T0Gc3qKhjAY3FyvCMwizzOLi1Ev9J8=\n+00+00"
我的输出结果如下:
{"act":"login","class":"profile","prftcf":"None","p":"asdasd","u":"asdasd","ver":"0.9.1"}
它没有显示code1
显示None
我正在使用Python 3.6。
答案 0 :(得分:0)
code1值与此相同,而username1和password1不同,所有值都是字符串: -
code1="OTcwMzAzY2NjY2NjY2NjY6eZwkOnclZLYgFCeIDITYbkoKNqeZFIOLYr97sRo5GNGwqpSh7RqlUn\nnsfJTFGCMhheFN+AiHzAxhFIq28T8k7wePciHu53gErQPsOKwoXe57To2QhNTsn3RBnqTuGlwvvT\nW32JYeZX4EfCBW3sDdb4l5ibCojZ+eenW2DnvF9UdW6u8H1Udc9e0WD/ZgyIJ73wisKezo58vuTS\nDhG8Ti9FIU6DhUw9PX2YsDuFSlUgfbcKA/u77/R1Qnzhoo+c3FTMymf6rd7Pvs3W5N7vRkd5sktT\ngTrsOXPvIE7Gk1JWgxsug4V9RGEkf8+M0LXW8Ykj9O5GPbz168Yl+UvCv+eQHGfq+zFs2G0vTDAk\no3LUupYwo6y+/EDSkulRJFxEaj88spNcIS3bsIvalXRoPfUZdCyT0flmekEOAu+Wvgts4XKVl8CT\nLr5BEOX2vAgwhttMRpsmbJ1vUlySzH2FcD1IG7a//yJCO1mF5wmwEQWiLEcb+uWRC0MIuw2NxuyE\nZN71TedMPqzesyg7Y/5aS5yd2PIslBiCiFhmSVkG6arSnf+LoKKJ8Tm6gJwaDgl5WMrtkzURpzuR\nzbx/reP5P24Kk9URgnO3iecvXp4O9ZWvS7knDAsMYXyHbsNwKDQujgK6vtNyOYpGiFFuf4mJggNR\nfhtRr/e4m/J07lIf1tCOB6r9sY/EbaA5k6wjs7UT1lTV/FAiKvSlDFE07voPcaGPyfZISzKKZXfr\nYeVmugGm86o8p+N019vB2T0Gc3qKhjAY3FyvCMwizzOLi1Ev9J8=\n+00+00"
password1="hello"
username1="akki"
data = {"act":"login","class":"profile","prftcf":"%s"%(code1),"p":"%s"%(password1),"u":"%s"%(username1),"ver":"0.9.1"}
print (data)
结果:
{'class': 'profile', 'act': 'login', 'ver': '0.9.1', 'p': 'hello', 'prftcf': 'OTcwMzAzY2NjY2NjY2NjY6eZwkOnclZLYgFCeIDITYbkoKNqeZFIOLYr97sRo5GNGwqpSh7RqlUn\nnsfJTFGCMhheFN+AiHzAxhFIq28T8k7wePciHu53gErQPsOKwoXe57To2QhNTsn3RBnqTuGlwvvT\nW32JYeZX4EfCBW3sDdb4l5ibCojZ+eenW2DnvF9UdW6u8H1Udc9e0WD/ZgyIJ73wisKezo58vuTS\nDhG8Ti9FIU6DhUw9PX2YsDuFSlUgfbcKA/u77/R1Qnzhoo+c3FTMymf6rd7Pvs3W5N7vRkd5sktT\ngTrsOXPvIE7Gk1JWgxsug4V9RGEkf8+M0LXW8Ykj9O5GPbz168Yl+UvCv+eQHGfq+zFs2G0vTDAk\no3LUupYwo6y+/EDSkulRJFxEaj88spNcIS3bsIvalXRoPfUZdCyT0flmekEOAu+Wvgts4XKVl8CT\nLr5BEOX2vAgwhttMRpsmbJ1vUlySzH2FcD1IG7a//yJCO1mF5wmwEQWiLEcb+uWRC0MIuw2NxuyE\nZN71TedMPqzesyg7Y/5aS5yd2PIslBiCiFhmSVkG6arSnf+LoKKJ8Tm6gJwaDgl5WMrtkzURpzuR\nzbx/reP5P24Kk9URgnO3iecvXp4O9ZWvS7knDAsMYXyHbsNwKDQujgK6vtNyOYpGiFFuf4mJggNR\nfhtRr/e4m/J07lIf1tCOB6r9sY/EbaA5k6wjs7UT1lTV/FAiKvSlDFE07voPcaGPyfZISzKKZXfr\nYeVmugGm86o8p+N019vB2T0Gc3qKhjAY3FyvCMwizzOLi1Ev9J8=\n+00+00', 'u': 'akki'}
您尚未发布上面的完整代码,因此可能在您编程的某处,code1的值变为null
或可以说None
。或者粘贴完整代码一次,我将尝试告诉错误发生的正确原因。