是否可以选择将Python文件保存到使用Pycharm的图像?
我有一个我完成的项目,一个要求是将所有代码添加到Word文档中,因为我有多个Python文件,每个代码将花费数小时,每个文件至少有200行。
有没有办法将它们导出到图像中(语法突出显示),以便我可以快速地将它们添加到Word文档中?
I have a project I finished, and one requirement is adding all of the code to a Word Document, doing it manually will take hours since I have multiple Python files, each with at least 200 lines.
Is there a way to export them (with the syntax highlighting) to images so I can do it quickly, and be able to add them to the Word Document?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如我在评论中所说的那样,如果您在每3秒内进行30行的屏幕截图,则可以在20分钟内进行400个包含12000行代码的屏幕截图,这对于许多项目来说可能就足够了。
但是,如果您真的想自动化它,一个想法可以是编写一个python文件,该文件递归递归读取项目中的文件,并在每个固定数量的行中写入内容,将内容写入.txt文件,并带有诸如file_n.txt的名称, n正在增加。然后,您使用 pillow << /a>。
As I said in the comments, if you take one screenshot of 30 lines in each 3 seconds, in 20 min you can take 400 screenshots containing 12000 lines of code, which might be enough for many projects .
But if you really want to automate it, one idea can be to write a python file that read the files in your project recursively and at each fixed number of lines write the content to a .txt file with a name like file_n.txt, where n is increasing. Then, you convert all the .txt to images programatically using pillow.
不是在Pycharm中,而是在VirSual Studio代码中,有和扩展称为
Not in pycharm but in Virsual Studio Code, there is and extension called CodeSnap, maybe just open your project from vscode then take clean screenshots of your code from there.