我有一个包含引用的字符串。很少有参考文献包含ISBN代码,我需要将其提取出来。我试过了,但它不是在循环中工作,但是,单独使用一个字符串。
示例数据:
曾庆安(2015年10月28日)。无线通信、网络和应用: WCNA 2014论文集。斯普林格。ISBN 978-81-322-2580-5
Dhavale,Sunita Vikrant (2017年3月10日)。先进的基于图像的垃圾邮件检测和过滤技术。好时,宾夕法尼亚州: IGI Global。第91页。ISBN 9781683180142。检索于2019年9月27日。
for line in dftrial['text']:
line = line.get_text()
print(type(line))
search_q = re.findall(r'ISBN (\d+)', line)
print(search_q)
发布于 2020-11-10 08:36:37
下面给出的程序可以很好地解决你的问题,它是用python3编写的
>>> text = ["Qing-An Zeng (October 28, 2015). Wireless Communications, Networking and Applications: Proceedings of WCNA 2014. Springer. ISBN 978-81-322-2580-5.","Dhavale, Sunita Vikrant (March 10, 2017). Advanced Image-Based Spam Detection and Filtering Techniques. Hershey, PA: IGI Global. p. 91. ISBN 9781683180142. Retrieved September 27, 2019."]
>>> for txt in text:
... x = re.findall("ISBN.[^.]*", txt)
... print(x)
...
['ISBN 978-81-322-2580-5']
['ISBN 9781683180142']
https://stackoverflow.com/questions/64760942
复制相似问题