I am searching for a long time on net. But no use. Please help or try to give some ideas how to achieve this.For example, the recognition character is apple,I want to put the "A" in apple at the end of the word,like"pplea".a-p-p-l-e-------pplea
I don't know where to modify it, is it from encode or decode? If so, how should it be modified?
CodePudding user response:
The following may help:
word = "apple"
def word_converter():
word2 = word word[0]
word3 = word2[1:]
print(word3)
word_converter()
CodePudding user response:
is simple using string position index
string = "apple"
#save fist char in one variable
first_char = string[0]
#remove first char of a string
string = string[1:]
#append first char of old string at the end of my new string
string = string first_char
#print the result
print(string)
CodePudding user response:
Its very simple. read string indexing in python
word = 'apple'
encoded = word[1:] word[0]
print(encoded)