python-os open micro-channel module, Probe

1.import os

    os.getcwd () # Get the current absolute path
    os.path.split ( 'D: \\ pythontest \\ ostest \\ Hello.py') # decomposed into the path (folder, file name), it returns a tuple Types of

    os.path.join ( 'D: \\ pythontest', 'ostest') #D: \\ pythontest \\ ostest 'splice path

    os.path.getsize ( 'D: \\ pythontest \\ ostest \\ hello.py') # View File Size

    os.listdir (os.getcwd ()) # View the current path of all files and directories

    os.path.exists ( 'D: \\ pythontest \\ ostest \\ hello.py') # see if the file exists


2. Start a program end pc

    1) os.startfile (path) #path installation path of the exe

    2) a client opens many times

# Path = input ( 'Please enter your exe to start the absolute path:')

# Count = int (input ( 'To start number:'))

# for index in range(count):

#         os.startfile(path)

    

Guess you like

Origin blog.csdn.net/weixin_33845477/article/details/90881420