# -*- coding: utf-8 -*-
import xlrd
import xlwt
import random
class Demo():
  def Suanfa1(self,num):
    for i in range(1,num):
      for j in range(i,num):
        print("%s*%s=%s"%(i,j,i*j),end=" ")
      print()
  def Suanfa2(self,num):
    for x in range(1,9):
      y=1
      while y<=x:
        print("%s*%s=%s" % (y,x,x*y),end=" ")
        # print(x,y)
        y+=1
      print("")
  def Read_from_Excle(self,path):
    workbook1=xlrd.open_workbook(path)
    sheet=workbook1.sheet_by_index(0)
    row1=sheet.cell(0,0).value
    row2=sheet.cell(1,0).value
    return int(row1),int(row2)

  def Write_to_Excle(self,date):
    workbook=xlwt.Workbook()
    sheet=workbook.add_sheet("test")
    sheet.write(0,0,"name")
    sheet.write(0,1,"sex")
    sheet.write(1,0,"老方1")
    sheet.write(1,1,str(date[0]))
    sheet.write(2,0,"momo")
    sheet.write(2,1,str(date[1]))
    workbook.save(r"E:\tmp\test004.xls.xls")
a=Demo()
# a.Suanfa1(10)
# a.Suanfa2(10)
data=a.Read_from_Excle(r'C:\Users\Administrator.USER-20160914PZ\Desktop\test001.xls')
print(data)
a.Write_to_Excle(data)