python - fetching values out of multiple brackets -


मेरे पास यह स्ट्रिंग है

  mod = 'ketobutyric_arp_rm (12); ऑक्सीकरण +% 28hw% 29 (1 9) ' 

और संख्याओं को कोष्ठकों में प्राप्त करना चाहते हैं, जैसा कि किसी प्रकार की सूची है:

  mod_pos = [' 12 ' '19']  

स्प्लिट का उपयोग थोड़ी चक्करदार लगता है, और मुझे नहीं पता कि इस पर एक विधि कैसे उपयोग करें।

कोई सुझाव कैसे मैं ऐसा कर सकते हैं?

यहां एक तरीका है:

  & gt; & gt; & gt; आयात पुनः & gt; & gt; & gt; Mod = 'ketobutyric_arp_rm (12); ऑक्सीकरण +% 28hw% 29 (19)' & gt; & gt; & gt; Re.findall (r '\ ((\ d +) \)', mod) ['12', '19']  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

c++ - Qt-how to convert a QByteArray to struct -

c++ - What exceptions does boost mapped_file_source throw? -