Creating A Script To Generate A List Of Dictionaries
<p>Welcome Back To Another Learning Adventure!</p>
<p>Today My Project Is On The Smaller Side. I Will Be Navigating How I Would Create A Python Script That Generates A List Of Dictionaries About Files That Are In My Dictionaries.</p>
<p>I’ll Be Using One Of My Favorite AWS Services Cloud 9, & Then Pushing My Code To Github.</p>
<p>GitHub Link: <a href="https://tinyurl.com/5n85dfnj" rel="noopener ugc nofollow" target="_blank">https://tinyurl.com/5n85dfnj</a></p>
<p>So First Things First I’m Going To Log Into My AWS Account, Go To Cloud9 & Then Open My Environment. I’m Going To Use <code>import os</code> To Enable Interaction With The Files & Directories On My Operating System.</p>
<p>In Order To Work With The Files In My Current Directory & Not All The Directories On My OS, I’m Using<code>os.getcwd()</code> & Then Storing It In The<strong> cwd</strong> Variable To Be Able To Implement It In Different Parts Of My Script.</p>
<p>Now I Can Store The List Of My Files In The <strong>files</strong> Variable For The Current Directory I’m In, With <code>os.listdir(cwd)</code> . So It’s The List Of Files ”os.listdir” In My Current Working Directory(cwd).</p>
<p>I’m Creating An Empty List To Store My Directories <code>file_list = []</code> .</p>
<p>I’ll Iterate Through My Files <code>for files in files:</code> , Create An Empty Dictionary For The Files Being Iterated Through <code>file_dict = {}</code> , & Then Specify What Information I Want From The Files.</p>
<p><a href="https://medium.com/@roriebri/creating-a-script-to-generate-a-list-of-dictionaries-e77cb15ca7e1"><strong>Click Here</strong></a></p>