zoukankan      html  css  js  c++  java
  • python第二十课——math模块中常用的函数


    属性:

    e:自然数

    pi:圆周率

    函数:

    ceil():向上取整

    floor():向下取整

    sqrt():开平方根

    radians():角度转弧度

    degrees():弧度转角度
    import math
    
    #属性:e和pi
    print(math.e)
    print(math.pi)
    
    #函数:
    #ceil(),floot():
    print(math.ceil(3.14))
    print(math.floor(3.14))
    print(math.ceil(-3.14))
    print(math.floor(-3.14))
    
    #radians(),degrees()
    print(math.radians(180)) #3.141592653589793
    print(math.radians(360)) #6.283185307179586
    print(math.degrees(6.283185307179586))

    sys模块中的argv属性:
    将当前正在被执行的这个.py文件的绝对路径(完整路径)-->str数据存入到列表对象中返回
    import sys
    print(sys.argv)

    os模块中的system()函数:
    在参数位置接受一些dos指令,执行相应的操作...
    import os
    print(os.system('ipconfig'))
    print(os.system('dir'))
    print(os.system('cls'))
  • 相关阅读:
    ssh整合
    自定义Java集合
    java图形界面写个小桌面,内置简单小软件
    java简单日历
    javaSwing
    javaScript封装
    java解析xml文件
    缺省适配器
    适配器模式
    自定义SWT控件一之自定义单选下拉框
  • 原文地址:https://www.cnblogs.com/hankleo/p/10434619.html
Copyright © 2011-2022 走看看