Python mendapatkan dir
import os
#full path
dir_path = os.path.dirname(os.path.realpath(__file__))
#current dir
cwd = os.getcwd()
mrjakobdk
import os
#full path
dir_path = os.path.dirname(os.path.realpath(__file__))
#current dir
cwd = os.getcwd()
import os
print('File name : ', os.path.basename(__file__))
print('Directory Name: ', os.path.dirname(__file__))
import os.path
from os import path
def main():
print ("Is it File?" + str(path.isfile('guru99.txt')))
print ("Is it File?" + str(path.isfile('myDirectory')))
if __name__== "__main__":
main()