Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- import subprocess
- import json
- if sys.platform == 'win32' or sys.platform == "cygwin":
- subprocess.Popen(['start', "C:"], shell= True)
- elif sys.platform == 'darwin' || sys.platform == "os2" || sys.platform == 'os2emx':
- subprocess.Popen(['open', "Macintosh HD"])
- elif sys.platform == "linux2":
- subprocess.Popen(['xdg-open', "/root"])
- else:
- try:
- subprocess.Popen(['xdg-open', "/root"])
- except OSError:
- print("You're using an unsupported operating system. Please manually navagate to your file explorer.")
- print("Please input a full file path. (Use your file explorer to get the file path.)")
- filePath = input("Filepath: ")
- print("Please input the file name. (Must be a json file.)")
- fileName = input("Filename: ")
- isJson = fileName.split(".")
- if (len(isJson) != 2):
- fileName += ".json"
- fullPath = filePath+"\\"+fileName
- with open(fullPath, "r") as file:
- content = json.load(file)
- print("In the file ", fileName, "is:\n",content)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement