写一个函数可以将一个字符串右移n位,例如 “hello world” 右移两位后ldhello wor str1 = "hello world" a = str1[-2:] b = str1[:-2] print(a+b) n = int(input('右移')) a = str1[-n:] b = str1[:-n] print(a+b)
微信扫一扫
写一个函数可以将一个字符串右移n位,例如 “hello world” 右移两位后ldhello wor str1 = "hello world" a = str1[-2:] b = str1[:-2] print(a+b) n = int(input('右移')) a = str1[-n:] b = str1[:-n] print(a+b)
相关推荐