Python-docx The icon is strange when saved. → Solution (changed to Python-docx → pywin32)

I am writing a program as a hobby. I'm trying to create a word document in python The icon will change when saved. The icon will look like a file on the left of the image. I would like a professor.

guide.py


import docx
 doc = docx.Document()
 doc.add_paragraph('Hello world!')
  doc.save(r"C:\Users\deer\Desktop\aaaaaaaaaaaaaa.docx")           

aaaaaaaaaaa無題.png

guide.py


import win32com.client
import docx
import pythoncom

pythoncom.CoInitialize()  #Call this before starting Word
#Start Word:Create an Application object
Application=win32com.client.Dispatch("Word.Application")
#Display Word on the screen:Set Visible property to True
Application.Visible = True
doc = Application.Documents.Add()
doc.Content.Text = "Aiue Okakikukeko"
doc.SaveAs("C:\\Users\dokar\Desktop\\bbaaaaaaaaaaaaaa")
#Quit Word:Call the Quit method
Application.Quit()
pythoncom.CoUninitialize()  #Call this after exiting Word

Recommended Posts

Python-docx The icon is strange when saved. → Solution (changed to Python-docx → pywin32)
When you think the update of ManjaroLinux is strange
What to do when PyCharm font is strange or garbled
Change the installation destination when --user is added to pip
Solution to the problem that the display is corrupted when the .exe command is included in the while loop in wsl2
The solution when an empty object is returned in go's json.Marshal
What to do when the value type is ambiguous in Python?
[PostgreSQL] How to grant superuser authority when the user (role) with superuser authority is 0
What to do when the result downloaded via scrapy is in English
What to do when the warning "The environment is in consistent ..." appears in the Anaconda environment
How to automatically notify by phone when the python system is down