Python: split – examples

A few example about the split function.

example


#############################
print '-' * 30

my_path = '/Users/stefan/XenDrive/__WORK/PROJECTS/PULSE/18P520_python/shots/VFX_0010/3d/camera/Chair.fbx'
print my_path
split_my_path = my_path.split('/')[1:3]
print split_my_path

print '-' * 30
#############################

string01 = "Line1-abcdef \nLine2-abc \nLine4-abcd"
print string01.split()
print string01.split(' ', 1)

print '-' 
Read more