Last active
August 29, 2015 14:18
-
-
Save starlightme/42641711a51b297ba5de to your computer and use it in GitHub Desktop.
字符串和列表的一种使用
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string = '12345' | |
L = [] | |
for i in string: | |
i += ' ' | |
L.append(i) | |
string = ''.join(L) | |
#重写一下,这样更短也更快 | |
string = '12345' | |
L = [i + ' ' for i in string] | |
string = ''.join(L) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment