私は怒っていますか?
私のテストでは、文字列がリスト[0]にある場合、python list.index('')はリスト内の文字列を見つけることができません!!!
なぜ?どうすれば見つけられますか?
これが私のコード例です:
list1 = ['WTF', '2.09', '\xc2\x80document.write(CurrencyFormat(Currency.convert((209/100),"GBP","EUR")));','0.00', 'Feminised', '6.88', '\xc2\x80document.write(CurrencyFormat(Currency.convert((688/100),"GBP","EUR")));', 'Regular', 'x10', '20.90', '\xc2\x80document.write(CurrencyFormat(Currency.convert((2090/100),"GBP","EUR")));', 'Feminised', 'x12', '82.56', '\xc2\x80document.write(CurrencyFormat(Currency.convert((8256/100),"GBP","EUR")));']
list2 = ['1','2','3','4','5', '1']
if list1.index('0.00'):
print "I found 0.00 in list 1 but if its in position[0], I cannot find it using index('0.00') - even it appears twice what gives?"
if list2.index('1'):
print 'weird'
else:
print 'I did not find 1 in list 2 even thought it is definitely there (twice infact)... WTF?'
print 'I can find it like this but I want to search by string >>> ' + list2[0]
print 'Or like this like this but I want to search by string >>> ' + list2[-1]
これにより、次の結果が得られます。
I found 0.00 in list 1 but if its in position[0], I cannot find it using index('0.00') - even it appears twice what gives?
I did not find 1 in list 2 even thought it is definitely there (twice infact)... WTF?
I can find it like this but I want to search by string >>> 1
Or like this like this but I want to search by string >>> 1
非常に明白な何かが欠けているに違いないと思います...しかし、それを理解することも答えを見つけることもできません...文字列を検索して、list1で「WTF」またはlist2で「1」を見つけるのを手伝ってください.....