Updated 3 years ago
File and OS handling homework
this is the notebook that Aakash did not review but that had lots of useful info
import os
os.getcwd()
'C:\\Users\\Sam\\Working Folder Jupyter'
os.listdir('.')
['.ipynb_checkpoints',
'.jovianrc',
'2020_09_12_Notes.ipynb',
'data',
'file-and-os-homework.ipynb',
'python-os-and-filesystem.ipynb',
'untitled.txt']
os.listdir('..') # same as a terminal -- guess it doesn't matter what the OS actually is?
['.anaconda',
'.bash_history',
'.cisco',
'.comsol',
'.conda',
'.condamanager',
'.condarc',
'.config',
'.dotnet',
'.gitconfig',
'.idlerc',
'.ipynb_checkpoints',
'.ipython',
'.jovian',
'.jovianrc',
'.jupyter',
'.matplotlib',
'.octave_hist',
'.oracle_jre_usage',
'.PyCharmCE2019.3',
'.pylint.d',
'.python_history',
'.spyder-py3',
'.spyder2',
'.spyder2-py3',
'.thumbnails',
'.VirtualBox',
'.vscode',
'3D Objects',
'anaconda3',
'AppData',
'Application Data',
'Contacts',
'Cookies',
'CUBA PICTURES',
'Desktop',
'Documents',
'Downloads',
'Dropbox',
'Evernote',
'Favorites',
'first-steps-with-python',
'first-steps-with-python-1',
'IntelGraphicsProfiles',
'KLayout',
'Links',
'Local Settings',
'logs',
'MicrosoftEdgeBackups',
'Music',
'My Documents',
'NetHood',
'New folder',
'NTUSER.DAT',
'ntuser.dat.LOG1',
'ntuser.dat.LOG2',
'NTUSER.DAT{13196478-2ba1-11eb-9c66-e1fc7f2ca750}.TM.blf',
'NTUSER.DAT{13196478-2ba1-11eb-9c66-e1fc7f2ca750}.TMContainer00000000000000000001.regtrans-ms',
'NTUSER.DAT{13196478-2ba1-11eb-9c66-e1fc7f2ca750}.TMContainer00000000000000000002.regtrans-ms',
'ntuser.ini',
'OneDrive',
'Pictures',
'PrintHood',
'projects',
'PycharmProjects',
'python-functions-and-scope',
'python-variables-and-data-types',
'python-variables-and-data-types-1',
'Recent',
'Roaming',
'Saved Games',
'scripts',
'Searches',
'SendTo',
'Start Menu',
'Templates',
'Videos',
'VirtualBox VMs',
'Working Folder Jupyter',
'zotero']
temp = os.makedirs('./data', exist_ok=True)
temp