Copypro02SaveInfo

  • Continue reading xiangtalan ,it's really amazing book

  • Prepare for my final exam and had human genetics and health exam

  • copy a few lines code

    
    def wfile(sstr,sfile,typeis,smsg):
        def wfile(sstr,sfile,typeis,smsg):
            mkdir(datapath)    # call this fuction to create file
            datafile = datapath+"\\"+sfile     #set a file to save the inticode
            file = open(datafile,"w") #open the file saved code ,if no exsist recreate one
            wrlist = sstr      # transfer the code information to the welist
            pdata = ""         # delet the variable and save the information which was showed on screen
            wdata = ""         # delet the variable and save the code information which was saved in txt
            for i in range(len(wrlist)):
                wdata = str(wrlist[i].replace('[',")).replace(']',")   # delet the [ 
                #wdata = wdata.replace(''''',").replace(''''',")       # delet the 
                wdata = wdata.replace('',").replace('',")              # delet the 
                file.write(str(wdata))                                 # write the file saved codeinfo
                pdata = pdata+wdata                                    # save the single code to pdata
            file.close()
            print("\033[1;31m"+pdata+"\033[0m")                        #show the product code info
            if typeis != "no": # whether show or not , if "no " not show
                # putout input finished  frame,and show the path of saved file
                tkinter.messagebox.showinfo("reminder",smsg+str(len(randstr))+"\n code info saved path"+datafile)
                root.withdraw()                                        # close the Deputy main window副主窗口
    
    • There are some bugs ,but I typed it same with on the book. I'll debug next month

      Take a leap.Take a chance.

      人生敢于尝试

python
87 views
Comments
登录后评论
Sign In
·

Wow, SHANTARAM is really a great book smile thanks for your sharing stuck_out_tongue_winking_eye

·

Wish you all the best of your final exams pray