我的for循环不是全部循环,因为我的范围只有范围(0,1),所以如何解决这个问题。。请帮忙:(谢谢!你知道吗
def cleanString(newstring):
newstring = newstring.replace("!", "")
newstring = newstring.replace("@", "")
newstring = newstring.replace("#", "")
newstring = newstring.replace("$", "")
newstring = newstring.replace("%", "")
return newstring
final_list = {'Category': categoryType, 'Notes': array}
e = str(final_list)
e1 = ''.join(e)
c = cleanString(newstring=e1)
arr_cat += [c]
print(range(len(arr_cat))
for i in range(len(arr_cat)):
print(arr_cat[i])
当我打印以检查存储10个数据的arr\u cat的范围时,print(range(len(arr\u cat))的输出是:
range(0, 1)
range(0, 1)
range(0, 1)
range(0, 1)
range(0, 1)
range(0, 1)
range(0, 1)
range(0, 1)
range(0, 1)
range(0, 1)
但我希望预期的结果是:
range(0, 1)
range(0, 2)
range(0, 3)
range(0, 4)
range(0, 5)
range(0, 6)
range(0, 7)
range(0, 8)
range(0, 9)
range(0, 10)
变量c的输出为:
1 I really love writing journals
2 The mat is very comfortable and I will buy it again likes
3 The mousepad is smooth
1 I really love writing journals
4 This pen is very special to me.
4 This pencil is very special to me.
5 Meaningful novels
4 It brights up my day like a lighter and makes me higher.
6 School foolscap
7 As soft as my heart.lovey
目前没有回答
相关问题 更多 >
编程相关推荐