Reverse a String

1 class practiceYln(): #创建一个名叫practiceYln的类
2     def __init__(self, string): #有参构造函数
3         self.string = string
4 def reversedtext(self, string): 5 str(self.string) #转换为字符 6 print (self.string[::-1]) #字符串切片 7 8 b=practiceYln('baby') 9 b.reversedtext('baby')
May we all proceed with wisdom and grace. https://www.cnblogs.com/YlnChen/
原文地址:https://www.cnblogs.com/YlnChen/p/12580000.html