我想从空列表开始
myList = []
并执行一些操作以创建包含2个器官的1个参数的列表,类似这样:
myList = [['a',10],['b', 4],['g',142]]
我试图做:
myList.append("[" + string + "," + str(number) + "]")
但是当我这样做时,所有这些都保存为字符串,并且它像这样保存值(带有“”):
myList[0] = "['a',5]"
我喜欢这样:
myList[0] = ['a',5]
答案 0 :(得分:0)
尝试
myList.append(['a',5])
您正在创建输入的字符串版本(两个字符串上的+
只是将字符串合并为一个字符串),但是您只需要添加所需的术语即可,而不是为其创建字符串。
答案 1 :(得分:0)
您可以使用
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.0.0'
implementation "com.android.support:support-v4:26.0.0"
implementation 'com.android.support:design:26.0.0'
implementation project(path: ':downloader_library')
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
implementation 'com.android.volley:volley:1.1.1'
implementation 'com.nineoldandroids:library:2.4.0'
// implementation 'com.javacodegeeks:slf4jconfig-javalogging:+'
implementation 'org.slf4j:slf4j-api:1.7.25'
implementation 'org.apache.commons:commons-compress:1.12'
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'org.apache.commons') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '1.12'
}
}
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "26.0.0"
}
}
}