We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dirs = '','usr','local','nginx','' print(dirs) ## ('', 'usr', 'local', 'nginx', '') linuxPath = '/'.join(dirs) print(linuxPath) ## /usr/local/nginx/ windowPath = 'C:' + '\\'.join(dirs) print(windowPath) ## C:\usr\local\nginx\ num = [1,2,3,4,5] print(s.join(num)) ## TypeError: sequence item 0: expected str instance, int found 列表中元素须为字符串
join方法可以将列表中的字符串类型元素值连接起来,并且可以指定元素值直接的分隔符。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
join方法可以将列表中的字符串类型元素值连接起来,并且可以指定元素值直接的分隔符。
The text was updated successfully, but these errors were encountered: