8
使用Python迭代字符串中的每个字符
在C ++中,我可以std::string像这样迭代: std::string str = "Hello World!"; for (int i = 0; i < str.length(); ++i) { std::cout << str[i] << std::endl; } 如何在Python中遍历字符串?
专业和发烧友程序员的问答