如何将单词的第一个字母移到末尾 [英] How to move the first letter of a word to the end
本文介绍了如何将单词的第一个字母移到末尾的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要去掉一个单词的第一个字母并将其移到末尾,例如:
I need to remove the first letter of a word and move it to the end, for example:
word = 'whatever'
# I want to convert it to 'hateverw'
到目前为止,我已经尝试过:
So far I've tried this:
word[1:] # hatever
但是我应该如何将第一个字母移到末尾?
But how should I move the first letter to the end?
推荐答案
您可以使用:
word[1:]+word[0]
这篇关于如何将单词的第一个字母移到末尾的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文