我有一个列表,上面有一堆字符串。到目前为止,我似乎还不知道如何从第一个字符到第七个字符这样的间隔只打印字符。你知道吗
我试图解决这个问题:
wellDescribedList["TestName", "RandomString", "EvenMoreRandomString", .....]
someItem = 5 # for example the second item from the list [start, end]
print(wellDescribedList[someItem][0, 7])
Python指出[0,7]
将导致TypeError,这在逻辑上不是我要查找的结果。你知道吗
如何在不使用任何循环(for、while等)的情况下解决此问题
您应该使用冒号而不是逗号:
相关问题 更多 >
编程相关推荐