最好的分裂代币? [英] best split tokens?
问题描述
让我们说,例如,一个人正在编写一个拼写检查器或
一些其他函数,其中一个字符串的内容来自文本编辑器的
$需要拆分b $ b文本框,以便生成的数组将每个单词
作为元素。是否有一个快捷方式来执行此操作,如果没有,那么分割功能实现
这个最好且最有效的令牌组是什么?
2006年9月8日13:41:48 -0700,Jay< ja ******* @ gmail.com>:
例如,让我们说一个人正在编写一个拼写检查器或
一些其他函数,其中一个字符串的内容从文本编辑器的
文本框中需要拆分,以便生成的数组将每个单词
作为元素。是否有一个快捷方式来执行此操作,如果没有,那么分割功能实现
的最佳且最有效的令牌组是什么?
your_string.split()
-
Felipe。
"周杰伦" < ja ******* @ gmail.comwrites:
例如,让我们说一个人正在编写一个拼写检查程序或者
一些其他函数,其中需要拆分文本编辑器的
文本框中的字符串内容,以便生成的数组包含每个单词
作为元素。是否有一个快捷方式来执行此操作,如果没有,那么分割功能实现
的最佳且最有效的令牌组是什么?
我只会使用字母字符串:
textbox =''Apple pie and penguins''>
words = re.findall(''[az] +'',textbox,re.I)
比方说,比方说,一个是编程拼写检查器或
一些其他函数,其中来自文本编辑器的字符串的内容
文本需要拆分框,以便生成的数组将每个单词
作为元素。是否有一个快捷方式来执行此操作,如果没有,那么分割功能实现
的最佳且最有效的令牌组是什么?
对于string_from_text_box.split()中的单词,你的意思是
:
spell_check (单词)
每个字符串都有一个split()方法,默认情况下,它会在空格的运行时拆分
字符串。
>> help(" .split)
会给你更多信息。
-tkc
Let''s say, for instance, that one was programming a spell checker or
some other function where the contents of a string from a text-editor''s
text box needed to be split so that the resulting array has each word
as an element. Is there a shortcut to do this and, if not, what''s the
best and most efficient token group for the split function to achieve
this?
8 Sep 2006 13:41:48 -0700, Jay <ja*******@gmail.com>:Let''s say, for instance, that one was programming a spell checker or
some other function where the contents of a string from a text-editor''s
text box needed to be split so that the resulting array has each word
as an element. Is there a shortcut to do this and, if not, what''s the
best and most efficient token group for the split function to achieve
this?your_string.split()
--
Felipe.
"Jay" <ja*******@gmail.comwrites:Let''s say, for instance, that one was programming a spell checker or
some other function where the contents of a string from a text-editor''s
text box needed to be split so that the resulting array has each word
as an element. Is there a shortcut to do this and, if not, what''s the
best and most efficient token group for the split function to achieve
this?I''d just use alphabetic strings:
textbox = ''Apple pie and penguins''
words = re.findall(''[a-z]+'', textbox, re.I)
Let''s say, for instance, that one was programming a spell checker orsome other function where the contents of a string from a text-editor''s
text box needed to be split so that the resulting array has each word
as an element. Is there a shortcut to do this and, if not, what''s the
best and most efficient token group for the split function to achieve
this?
Do you mean like
for word in string_from_text_box.split():
spell_check(word)
Every string has a split() method which, by default, splits the
string at runs of whitespace.
>>help("".split)
will give you more info.
-tkc
这篇关于最好的分裂代币?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!