lt = []
r = ""
m = input('输入字符串:')
# 字符串转数组
for string in m:
lt.append(string)
print('转换数组后为:'+ lt)
# 向左移动
lt.insert(len(lt), lt[0])
lt.remove(lt[0])
# 数组转字符
for s in lt:
r = r+s
print('移动后:'+r)
用到的方法:
list.insert(index, obj)
index -- 对象 obj 需要插入的索引位置。
obj -- 要插入列表中的对象
remove 移动索引为0的字符
运行结果