一、python单词反转
list1 = "aaa bbb ccc"
list1 = list1.split()
###此时list1=["aaa","bbb","ccc"]###
list1 = list1[::-1]
###此时list1=["ccc","bbb","aaa"]###
list1 = " ".join(list1)
###此时list1="ccc bbb aaa"###
print(list1)
###输出ccc bbb aaa###
a='abcd'
a = ' '.join (a)
###此时a='a b c d'###
a='abc edf degd'
a = ' '.join (a)
###此时a='a b c e d f d e g d'###
- join可以快速的再每个字符中间加上我们赋值的字符
a='abcedfdegd'
a ='+'.join (a)
###此时a='a+b+c+ +e+d+f+ +d+e+g+d'###
二、C++单词反转
#include
#include
using namespace std;
int main(){
string a[100];
int i=0;
while(cin>>a[i]){
i++;
}
for(int x=i-1;x>=0;x--)
cout<