How to write Text into a File using Python, where different parts of the Text has different font-size (Title, Sub-Title, content). How to place a picture in the file using Python?
Python is a programming language capable of manipulating text as variables. 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.
For example, you can create a python file in html like this:
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.
As for the images, I suggest you go to:
[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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.