zoukankan      html  css  js  c++  java
  • python_模块学习

    '''
    import sys
    print(sys.path) #打印环境变量

    #运行结果为:['D:\PyCharm Community Edition 2018.2.2\NewYear\untitled1\Python',
    # 'D:\PyCharm Community Edition 2018.2.2\NewYear\untitled1',
    # 'D:\Python\python36.zip', 'D:\Python\DLLs',
    # 'D:\Python\lib', ---标准库保存位置
    # 'D:\Python',
    # 'D:\Python\lib\site-packages'] ---第三方库保存位置

    print(sys.argv) #打印相对路径
    #打印结果:['D:\PyCharm Community Edition 2018.2.2\NewYear\untitled1\Python\模块初识.py']
    print(sys.argv[2]) #取出列表中第三个,计算机默认从0开始计数
    '''

    import os
    #cmd_res = os.system("dir") #执行命令不保存结果
    cmd_res1 = os.popen("dir").read()
    #print(cmd_res)
    print(cmd_res1)

    #当前文件路径下创建目录
    os.mkdir("new_dir1")

  • 相关阅读:
    导航
    占位
    django(一)
    进程与线程
    网络编程
    反射 单例模式
    面向对象及命名空间
    logging,包
    模块(二)os hashlib
    装饰器&递归
  • 原文地址:https://www.cnblogs.com/monica001/p/10435186.html
Copyright © 2011-2022 走看看