python模式标识符?正则表达式?
所以我需要的是确定模式“X”或“spaceCAPITAL” 示例:python模式标识符?正则表达式?,python,regex,list,Python,Regex,List,所以我需要的是确定模式“X”或“spaceCAPITAL” 示例: string="Hello World, This is KZ" 该计划将挑选: example_list = [W,T,K] 试试这个: import re re.findall(' ([A-Z])', string) 尽量避免命名字符串string。这是runcode()回溯中的一个{IDLE内部错误(上次调用):文件“C:\Python33\lib\idlelib\rpc.py”,第236行,在异步队列if thre
string="Hello World, This is KZ"
该计划将挑选:
example_list = [W,T,K]
试试这个:
import re
re.findall(' ([A-Z])', string)
尽量避免命名字符串
string
。这是runcode()回溯中的一个{IDLE内部错误(上次调用):文件“C:\Python33\lib\idlelib\rpc.py”,第236行,在异步队列if threading.current_thread()!=self.sockthread:AttributeError:'MyRPCClient'对象没有属性'sockthread'}是我犯的错误吗encountering@user2899835这与我发布的代码无关。我知道,它不喜欢我重新导入。@user2899835 Google this:AttributeError:“MyRPCClient”对象没有属性“socksThread”,你会知道出了什么问题。
>>> import re
>>> strs = "Hello World, This is KZ"
>>> re.findall(r'\s([A-Z])', strs)
['W', 'T', 'K']