主要是想记录一个join()函数
class Solution:
def reverseLeftWords(self, s, n):
res = []
for i in range(n, n + len(s)):
res.append(s[i % len(s)])
return ''.join(res)
Python中有.join()和os.path.join()两个函数,具体作用如下:
. join():将序列(也就是字符串、元组、列表、字典)中的元素以指定的字符连接生成一个新的字符串。例子在https://blog.youkuaiyun.com/y_three/article/details/109543652
os.path.join():将多个路径进行拼接。或者称之为合并目录。