python类MakeTime()的实例源码

testMSOffice.py 文件源码 项目:OSPTF 作者: xSploited 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def TextExcel(xl):
    xl.Visible = 0
    if xl.Visible: raise error("Visible property is true.")
    xl.Visible = 1
    if not xl.Visible: raise error("Visible property not true.")

    if int(xl.Version[0])>=8:
        xl.Workbooks.Add()
    else:
        xl.Workbooks().Add()


    xl.Range("A1:C1").Value = (1,2,3)
    xl.Range("A2:C2").Value = ('x','y','z')
    xl.Range("A3:C3").Value = ('3','2','1')

    for i in xrange(20):
        xl.Cells(i+1,i+1).Value = "Hi %d" % i

    if xl.Range("A1").Value != "Hi 0":
        raise error("Single cell range failed")

    if xl.Range("A1:B1").Value != ((Unicode("Hi 0"),2),):
        raise error("flat-horizontal cell range failed")

    if xl.Range("A1:A2").Value != ((Unicode("Hi 0"),),(Unicode("x"),)):
        raise error("flat-vertical cell range failed")

    if xl.Range("A1:C3").Value != ((Unicode("Hi 0"),2,3),(Unicode("x"),Unicode("Hi 1"),Unicode("z")),(3,2,Unicode("Hi 2"))):
        raise error("square cell range failed")

    xl.Range("A1:C3").Value =((3,2,1),("x","y","z"),(1,2,3))

    if xl.Range("A1:C3").Value  != ((3,2,1),(Unicode("x"),Unicode("y"),Unicode("z")),(1,2,3)):
        raise error("Range was not what I set it to!")

    # test dates out with Excel
    xl.Cells(5,1).Value = "Excel time"
    xl.Cells(5,2).Formula = "=Now()"

    import time
    xl.Cells(6,1).Value = "Python time"
    xl.Cells(6,2).Value = pythoncom.MakeTime(time.time())
    xl.Cells(6,2).NumberFormat = "d/mm/yy h:mm"
    xl.Columns("A:B").EntireColumn.AutoFit()

    xl.Workbooks(1).Close(0)
    xl.Quit()
testMSOffice.py 文件源码 项目:pupy 作者: ru-faraon 项目源码 文件源码 阅读 48 收藏 0 点赞 0 评论 0
def TextExcel(xl):
    xl.Visible = 0
    if xl.Visible: raise error("Visible property is true.")
    xl.Visible = 1
    if not xl.Visible: raise error("Visible property not true.")

    if int(xl.Version[0])>=8:
        xl.Workbooks.Add()
    else:
        xl.Workbooks().Add()


    xl.Range("A1:C1").Value = (1,2,3)
    xl.Range("A2:C2").Value = ('x','y','z')
    xl.Range("A3:C3").Value = ('3','2','1')

    for i in xrange(20):
        xl.Cells(i+1,i+1).Value = "Hi %d" % i

    if xl.Range("A1").Value != "Hi 0":
        raise error("Single cell range failed")

    if xl.Range("A1:B1").Value != ((Unicode("Hi 0"),2),):
        raise error("flat-horizontal cell range failed")

    if xl.Range("A1:A2").Value != ((Unicode("Hi 0"),),(Unicode("x"),)):
        raise error("flat-vertical cell range failed")

    if xl.Range("A1:C3").Value != ((Unicode("Hi 0"),2,3),(Unicode("x"),Unicode("Hi 1"),Unicode("z")),(3,2,Unicode("Hi 2"))):
        raise error("square cell range failed")

    xl.Range("A1:C3").Value =((3,2,1),("x","y","z"),(1,2,3))

    if xl.Range("A1:C3").Value  != ((3,2,1),(Unicode("x"),Unicode("y"),Unicode("z")),(1,2,3)):
        raise error("Range was not what I set it to!")

    # test dates out with Excel
    xl.Cells(5,1).Value = "Excel time"
    xl.Cells(5,2).Formula = "=Now()"

    import time
    xl.Cells(6,1).Value = "Python time"
    xl.Cells(6,2).Value = pythoncom.MakeTime(time.time())
    xl.Cells(6,2).NumberFormat = "d/mm/yy h:mm"
    xl.Columns("A:B").EntireColumn.AutoFit()

    xl.Workbooks(1).Close(0)
    xl.Quit()
testMSOffice.py 文件源码 项目:remoteControlPPT 作者: htwenning 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def TextExcel(xl):
    xl.Visible = 0
    if xl.Visible: raise error("Visible property is true.")
    xl.Visible = 1
    if not xl.Visible: raise error("Visible property not true.")

    if int(xl.Version[0])>=8:
        xl.Workbooks.Add()
    else:
        xl.Workbooks().Add()


    xl.Range("A1:C1").Value = (1,2,3)
    xl.Range("A2:C2").Value = ('x','y','z')
    xl.Range("A3:C3").Value = ('3','2','1')

    for i in xrange(20):
        xl.Cells(i+1,i+1).Value = "Hi %d" % i

    if xl.Range("A1").Value != "Hi 0":
        raise error("Single cell range failed")

    if xl.Range("A1:B1").Value != ((Unicode("Hi 0"),2),):
        raise error("flat-horizontal cell range failed")

    if xl.Range("A1:A2").Value != ((Unicode("Hi 0"),),(Unicode("x"),)):
        raise error("flat-vertical cell range failed")

    if xl.Range("A1:C3").Value != ((Unicode("Hi 0"),2,3),(Unicode("x"),Unicode("Hi 1"),Unicode("z")),(3,2,Unicode("Hi 2"))):
        raise error("square cell range failed")

    xl.Range("A1:C3").Value =((3,2,1),("x","y","z"),(1,2,3))

    if xl.Range("A1:C3").Value  != ((3,2,1),(Unicode("x"),Unicode("y"),Unicode("z")),(1,2,3)):
        raise error("Range was not what I set it to!")

    # test dates out with Excel
    xl.Cells(5,1).Value = "Excel time"
    xl.Cells(5,2).Formula = "=Now()"

    import time
    xl.Cells(6,1).Value = "Python time"
    xl.Cells(6,2).Value = pythoncom.MakeTime(time.time())
    xl.Cells(6,2).NumberFormat = "d/mm/yy h:mm"
    xl.Columns("A:B").EntireColumn.AutoFit()

    xl.Workbooks(1).Close(0)
    xl.Quit()
testMSOffice.py 文件源码 项目:CodeReader 作者: jasonrbr 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def TextExcel(xl):
    xl.Visible = 0
    if xl.Visible: raise error("Visible property is true.")
    xl.Visible = 1
    if not xl.Visible: raise error("Visible property not true.")

    if int(xl.Version[0])>=8:
        xl.Workbooks.Add()
    else:
        xl.Workbooks().Add()


    xl.Range("A1:C1").Value = (1,2,3)
    xl.Range("A2:C2").Value = ('x','y','z')
    xl.Range("A3:C3").Value = ('3','2','1')

    for i in range(20):
        xl.Cells(i+1,i+1).Value = "Hi %d" % i

    if xl.Range("A1").Value != "Hi 0":
        raise error("Single cell range failed")

    if xl.Range("A1:B1").Value != ((Unicode("Hi 0"),2),):
        raise error("flat-horizontal cell range failed")

    if xl.Range("A1:A2").Value != ((Unicode("Hi 0"),),(Unicode("x"),)):
        raise error("flat-vertical cell range failed")

    if xl.Range("A1:C3").Value != ((Unicode("Hi 0"),2,3),(Unicode("x"),Unicode("Hi 1"),Unicode("z")),(3,2,Unicode("Hi 2"))):
        raise error("square cell range failed")

    xl.Range("A1:C3").Value =((3,2,1),("x","y","z"),(1,2,3))

    if xl.Range("A1:C3").Value  != ((3,2,1),(Unicode("x"),Unicode("y"),Unicode("z")),(1,2,3)):
        raise error("Range was not what I set it to!")

    # test dates out with Excel
    xl.Cells(5,1).Value = "Excel time"
    xl.Cells(5,2).Formula = "=Now()"

    import time
    xl.Cells(6,1).Value = "Python time"
    xl.Cells(6,2).Value = pythoncom.MakeTime(time.time())
    xl.Cells(6,2).NumberFormat = "d/mm/yy h:mm"
    xl.Columns("A:B").EntireColumn.AutoFit()

    xl.Workbooks(1).Close(0)
    xl.Quit()
testMSOffice.py 文件源码 项目:mac-package-build 作者: persepolisdm 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def TextExcel(xl):
    xl.Visible = 0
    if xl.Visible: raise error, "Visible property is true."
    xl.Visible = 1
    if not xl.Visible: raise error, "Visible property not true."

    if int(xl.Version[0])>=8:
        xl.Workbooks.Add()
    else:
        xl.Workbooks().Add()


    xl.Range("A1:C1").Value = (1,2,3)
    xl.Range("A2:C2").Value = ('x','y','z')
    xl.Range("A3:C3").Value = ('3','2','1')

    for i in xrange(20):
        xl.Cells(i+1,i+1).Value = "Hi %d" % i

    if xl.Range("A1").Value <> "Hi 0":
        raise error, "Single cell range failed"

    if xl.Range("A1:B1").Value <> ((Unicode("Hi 0"),2),):
        raise error, "flat-horizontal cell range failed"

    if xl.Range("A1:A2").Value <> ((Unicode("Hi 0"),),(Unicode("x"),)):
        raise error, "flat-vertical cell range failed"

    if xl.Range("A1:C3").Value <> ((Unicode("Hi 0"),2,3),(Unicode("x"),Unicode("Hi 1"),Unicode("z")),(3,2,Unicode("Hi 2"))):
        raise error, "square cell range failed"

    xl.Range("A1:C3").Value =((3,2,1),("x","y","z"),(1,2,3))

    if xl.Range("A1:C3").Value  <> ((3,2,1),(Unicode("x"),Unicode("y"),Unicode("z")),(1,2,3)):
        raise error, "Range was not what I set it to!"

    # test dates out with Excel
    xl.Cells(5,1).Value = "Excel time"
    xl.Cells(5,2).Formula = "=Now()"

    import time
    xl.Cells(6,1).Value = "Python time"
    xl.Cells(6,2).Value = pythoncom.MakeTime(time.time())
    xl.Cells(6,2).NumberFormat = "d/mm/yy h:mm"
    xl.Columns("A:B").EntireColumn.AutoFit()

    xl.Workbooks(1).Close(0)
    xl.Quit()


问题


面经


文章

微信
公众号

扫码关注公众号