[英]How to write text into a file with different font-sizes using Python?
How to write Text into a File using Python, where different parts of the Text has different font-size (Title, Sub-Title, content).如何使用 Python 将文本写入文件,其中文本的不同部分具有不同的字体大小(标题、副标题、内容)。 How to place a picture in the file using Python?
如何使用 Python 在文件中放置图片?
Python is a programming language capable of manipulating text as variables. Python 是一种能够将文本作为变量进行操作的编程语言。 It does not provide a graphics engine to achieve what you are asking.
它不提供图形引擎来实现您的要求。
You need to decide which output format you want your file to be in, example: .html and then format the output as such.您需要决定您希望文件采用哪种输出格式,例如:.html,然后将输出格式设置为这样。
For example, you can create a python file in html like this:例如,您可以像这样在 html 中创建一个 python 文件:
file_handle = open("test.html", "w+b")
html = "<h1>I am a big header</h1><h2>I am a smaller header</h2><h6>I am the smalles header</h6>"
file_handle.write(html)
file_handle.close()
Next, navigate to your folder and open test.html in any browser.接下来,导航到您的文件夹并在任何浏览器中打开 test.html。
As for the images, I suggest you go to:至于图片,我建议你去:
[1]: http://www.w3schools.com/html/html_images.asp [1]:http://www.w3schools.com/html/html_images.asp
Good luck!祝你好运!
for the text, I would write out different lines try this using turtle:对于文本,我会写出不同的行,尝试使用乌龟:
h1 = 10
txt = 5
turtle.write('<example',font('Arial,h1,'normal')
so on and so on.等等等等。 as for the images, I don't know.
至于图片,我不知道。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.