Skip to content

Latest commit

 

History

History
34 lines (27 loc) · 556 Bytes

python_split.md

File metadata and controls

34 lines (27 loc) · 556 Bytes

gitblog-logo

#!/usr/bin/env python
#coding:utf-8


names="亮哥 李白 杜甫"
names1="nginx:php:mysql"
print names
print names1

## 默认空格拆分
namesList=names.split()
## 指定:拆分
names1List=names1.split(':')
print namesList
print names1List

print namesList[1]
print names1List[2]