Python读入docx维护要点

2024-05-29 10:16:18 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图解析一个docx文档,从使用正则表达式获取引用

我目前正在使用Python docx,它不保留以下内容:

docx中的行沿以下行:

[1] A. Calderón, M. Ruiz, Coverage of ISO/IEC 12207 software lifecycle process by a sim-ulation-based serious game, in: Proceedings of the 16th International Conference on Process Improvement and Capability dEtermination (SPICE), Dublin, Ireland, 2016, pp. 59–70.
[2] M. Kosa, M. Yilmaz, R. O’Connor, P. Clarke, Software engineering education and games: a systematic literature review, J. Universal Comput. Sci. 22 (12) (2016) 1558–1574. [3] C. Abt, Serious Games, University Press of America, Lanhan, MD, 2002.
[4] A. Heredia, R. Colomo-Palacios, A. Amescua-Seco, A systematic mapping study on software process education, in: Proceedings of the 1st International Workshop on Software Process Education, Training and Professionalism (SPETP), 2015, pp. 7–17.
[5] V. Garousi, M. Felderer, M. Mäntylä, The need for multivocal literature reviews in software engineering: complementing systematic literature reviews with grey litera-ture, Proceeding of the 20th International Conference on Evaluation and Assessment in Software Engineering (EASE), ACM, 2016 Article n. 26.
[6] B. Kitchenham, S. Charters, Guidelines For Performing Systematic Literature Re-views in Software Engineering, Keele University and Durham University Joint Re-port, 2007.

但是,当我使用python docx解析它时,我得到以下输出:

A. Calderón, M. Ruiz, Coverage of ISO/IEC 12207 software lifecycle process by a sim-ulation-based serious game, in: Proceedings of the 16th International Conference on Process Improvement and Capability dEtermination (SPICE), Dublin, Ireland, 2016, pp. 59–70.
M. Kosa, M. Yilmaz, R. O’Connor, P. Clarke, Software engineering education and games: a systematic literature review, J. Universal Comput. Sci. 22 (12) (2016) 1558–1574.
C. Abt, Serious Games, University Press of America, Lanhan, MD, 2002.
A. Heredia, R. Colomo-Palacios, A. Amescua-Seco, A systematic mapping study on software process education, in: Proceedings of the 1st International Workshop on Software Process Education, Training and Professionalism (SPETP), 2015, pp. 7–17.
V. Garousi, M. Felderer, M. Mäntylä, The need for multivocal literature reviews in software engineering: complementing systematic literature reviews with grey litera-ture, Proceeding of the 20th International Conference on Evaluation and Assessment in Software Engineering (EASE), ACM, 2016 Article n. 26. B. Kitchenham, S. Charters, Guidelines For Performing Systematic Literature Re-views in Software Engineering, Keele University and Durham University Joint Re-port, 2007.

我继承了一个项目,该项目解析文档,然后使用正则表达式提取引用。我正在尝试改进功能,并将其扩展到允许docx,实现上述功能意味着我不必尝试找出一个新的正则表达式(因为引用不是统一的,以前的开发人员检查了以[number]开头的行),继续这样做会有很大帮助

[\d*] (..[^[], )([^[]), (?:([^[]*))

非常感谢任何帮助或建议


Tags: andoftheinonsoftwareprocessdocx

热门问题