#-*- coding: utf-8 -*-�@�@
#-*- coding: cp950 -*-�@
#顯示中文註解用
#-*- coding: utf-8 -*-�@�@
#-*- coding: cp950 -*-�@
#顯示中文註解用
s = 'Hello, World'
#字串顯示方式
#str[start:end:step]
#str[起始位置:結束位置:間隔]
print(s)
print(s[2:])
print(s[0:7]+'The Beautiful'+s[6:12])
print(s[::])
print(s[::2])
print(s[::-1])
print(s[-1:0:-2])
print("123")
print(s[-1:-2:-1])
print(s[-1:0:])
print("321")
輸出:
Hello, World
llo, World
Hello, The Beautiful World
Hello, World
Hlo ol
dlroW ,olleH
drW,le
123
d
321