from docx import Document
from docx.enum.style import WD_STYLE_TYPE
from docx.enum.text import WD_ALIGN_PARAGRAPH
import os

class Word:
    def __init__(self):
#         pass
        self.doc = Document()
    def write_word(self):
        '''主函数'''
        titles = input('请输入标题:')
        self.add_titles(titles)   #可以在被的函数中通过self调用其它的函数方法,self即为类本身

        sub_titles = input('请输入副标题:')
        self.add_subtitles(sub_titles)

        para = input('请输入正文:')
        self.add_paragraphs(para)

        filename = input('请输入文件名:')
        self.save_docss(filename)

    def add_titles(self, text):
        '''添加标题方法'''
        self.doc.add_heading(text)

    def add_subtitles(self, subtitle):
        self.doc.add_paragraph(subtitle, 'Subtitle')

    def add_paragraphs(self,para):
        self.doc.add_paragraph(para)

    def save_docss(self, filename):
        name =filename + '.' + 'docx'
        self.doc.save(name)

def main():
    aa = Word()
    aa.write_word()
#     aa.add_titles('bb')

if __name__ =="__main__":
    main()

# aa.add_subtitles()
请输入标题:aa
请输入副标题:bb
请输入正文:cc
请输入文件名:dd
os.
Object `join` not found.
import math
class Solution(object):
    def is_square(self,n):
        s=int(math.sqrt(n))
        return s*s==n

    def numSquares(self, n):
        if Solution.is_square(self,n)==True:
            return 1
        while n%4==0:
            n=n/4
        if n%8==7:
            return 4
        i=1
        while i*i
import math
class Solution(object):

    def is_square(self,n):
        s=int(math.sqrt(n))
        return s*s==n
    def numSquares(self, n):
        if self.is_square(n)== True:
            return 1
        while n%4==0:
            n=n/4
        if n%8==7:
            return 4
        i=1
        while i*i