Skip to content
New issue

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

#557 Python 字符串与列表 之间的转换 #1

Open
LiuL0703 opened this issue Apr 9, 2017 · 2 comments
Open

#557 Python 字符串与列表 之间的转换 #1

LiuL0703 opened this issue Apr 9, 2017 · 2 comments

Comments

@LiuL0703
Copy link
Owner

LiuL0703 commented Apr 9, 2017

No description provided.

@LiuL0703
Copy link
Owner Author

LiuL0703 commented Apr 9, 2017

字符串翻转

"hello"[::-1]  //"olleh"

字符串转化为列表

s = "hello world"
s = s.split(' ')    //["hello","world"]

列表转化为字符串

" ".join(s)   //"hello world"

@LiuL0703
Copy link
Owner Author

LiuL0703 commented Apr 9, 2017

列表自带翻转属性

a = ["a","b","c","d"]
a.reverse() 
print(a)    //["d","c","b","a"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant