我遇到的问题是python中的赋值正在改变数据类型:
码
# creating list from tuple
newitem = list(item)
# assignment is done here
m100_productBrand = newitem[8],
print "type(item)" , type(item)
print "type(newitem)" , type(newitem)
print "newitem" , newitem
print "newitem[8] : " , newitem[8] , type(newitem[8])
print "m100_productBrand: " , m100_productBrand , type(m100_productBrand)
输出
type(item) <type 'tuple'>
type(newitem) <type 'list'>
newitem ['MOBEFMMWJVUE5ZKB', 'New Model:Good Ear phone', 'A&K G 4040(Black)', 890.0, 890.0, '', 'https://someurl', 10.0, 'A&K', '1', 990.0, 'Mobiles>Handsets', 'https://someurl', 'https://someurl', 'https://someurl', '1', 'Mobile, Battery, Charger, Earphone', '', 'G 4040', 'Black', 'Feature Phones', 'Dual Sim', 2.4, '320 x 480 Pixels', 'HVGA', '', '', '', 32.0, 32.0, 0.0, 0.0, 'Yes', '', '', 'GSM, GSM', '', '', '', 'Yes', '3.5 mm', 'Normal', '', 1050.0, '1 Year Manufacturer Warranty']
newitem[8] : A&K <type 'str'>
m100_productBrand: ('A&K',) <type 'tuple'>
我很困惑,因为即使newitem [8]是字符串,m100_productBrand也会变成元组。
其他信息:
答案 0 :(得分:0)
正确的代码是:
@Entity(tableName = "test")
public class Test{
@PrimaryKey
@ColumnInfo(name = "_id")
private int id;
@ColumnInfo(typeAffinity = ColumnInfo.BLOB)
private byte[] image;
}