1樓:雞賊的魯魯修
此題目難度屬於簡單,不用調library,不用ASKII碼。時間複雜度為O(n), 空間複雜度為O(n).
english
='abcdefghijklmnopqrstuvwxyz0123456789'
output=
buffer=''
fors
instr:if
sinenglishors
inenglish
.upper
():buffer+=s
else:if
buffer
:output.(
buffer
)buffer=''
output.(
s)ifbuffer
:output.(
buffer
)執行結果:
str = '今天是我喜歡Python的第123天'
output = ['今', '天', '是', '我', '喜', '歡', 'Python', '的', '第', '123', '天']
2樓:SmoothNLP
import smoothnlp
smoothnlp.segment("今天是我喜歡Python的第123天")
>> ['今天', '是', '我', '喜歡', 'Python', '的', '第', '123', '天']
安裝:pip install smoothnlphttps://
3樓:Vukr
if__name__
=="__main__":s
='今天是我喜歡Python的第123天'
temp=''
lst=
forcins
:if'\u4e00
'<=c<='\u9fff':
iftemp
!=''
:lst.(
temp
)temp=''
lst.(c
)else
:temp+=c
(lst)
關於英語中現在分詞做狀語和過去分詞做狀語的問題。這兩種有區別嗎?
張磊 嗯。意思差不多,只是看你怎麼用了。現在分詞一般表示主動,表示被修飾成分自身的一種性質或狀態,是自發的。如 The teacher comes into the classroom,holding her book in her hands.過去分詞一般表示被動,表示被修飾成分被動地進入某種狀態...
Python 中None怎麼用?
首先,你的提問中有一處有歧義,先澄清一下。你這裡提到的不輸入值,不知道是說直接按回車還是按Ctrl D UNIX 或Ctrl Z Win 來產生乙個EOF結束輸入呢?那麼,如果是按回車,輸入值將成為空字串 如果是EOF,則會有乙個 EOFError從input 函式丟擲。前者既然你知道是空字串了,那...
python中enumerate object究竟是一種怎樣的存在形式呢?
l Ass We Can type of l is tuplee enumerate l type of e is enumerate objectforv inenumerate e type of enumerate e is enumerate object print v type of v...