{"id":39095,"date":"2016-11-23T18:29:13","date_gmt":"2016-11-24T00:29:13","guid":{"rendered":"http:\/\/quirinosawesomeprojects.wordpress.com\/?p=718"},"modified":"2016-11-23T18:29:13","modified_gmt":"2016-11-24T00:29:13","slug":"creating-and-using-your-own-libraries","status":"publish","type":"post","link":"https:\/\/kenscourses.com\/tc101fall2016\/syndicated\/creating-and-using-your-own-libraries\/","title":{"rendered":"Creating and using your own libraries"},"content":{"rendered":"<p class=\"syndicated-attribution\"><em> --Originally published at <a href=\"https:\/\/quirinosawesomeprojects.wordpress.com\/2016\/11\/23\/creating-and-using-your-own-libraries\/\"><a href=\"https:\/\/quirinosawesomeprojects.wordpress.com\">Quirino\u00b4s Projects<\/a><\/a><\/em><br \/><\/p>\n<p>Sure you know how to import libraries, if you don&#8217;t , just check my post about that<\/p>\n<p>Somewhat you want to do something many times in different programs, and of course you would like to use a function but taking a function from another program then copy\/pasting it to your current can get tedious, thats why you should be creating your own libraries, its simple, you create a python program as normal that contains the functions that your are going to use, in my case i created a quirinoStuff.py that contained 3 functions useful for opening files, just doing open() is easy you might say but this one ensures that the file you are trying to open exists so there won&#8217;t be crashes because of the user not typing correctly, so we import as it was a built in one like:<\/p>\n<p>from quirinoStuff import openFile<\/p>\n<p>And know we can use openFile in our program without the need to write the function again<\/p>\n<p>You can check an example in my GitHub\u00a0https:\/\/github.com\/QuirinoC\/46Exercises<br \/>\nIn the simpleIO37.py<\/p><br \/>  <a rel=\"nofollow\" href=\"http:\/\/feeds.wordpress.com\/1.0\/gocomments\/quirinosawesomeprojects.wordpress.com\/718\/\"><img alt=\"\" border=\"0\" src=\"http:\/\/feeds.wordpress.com\/1.0\/comments\/quirinosawesomeprojects.wordpress.com\/718\/\" \/><\/a> <img alt=\"\" border=\"0\" src=\"https:\/\/pixel.wp.com\/b.gif?host=quirinosawesomeprojects.wordpress.com&#038;blog=115196269&%23038;post=718&%23038;subd=quirinosawesomeprojects&%23038;ref=&%23038;feed=1\" width=\"1\" height=\"1\" \/>","protected":false},"excerpt":{"rendered":"<p>&#8211;Originally published at Quirino\u00b4s Projects Sure you know how to import libraries, if you don&#8217;t , just check my post about that Somewhat you want to do something many times in different programs, and of course you would like to use a function but taking a function from another program then copy\/pasting it to your &hellip; <a href=\"https:\/\/kenscourses.com\/tc101fall2016\/syndicated\/creating-and-using-your-own-libraries\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Creating and using your own libraries<\/span><\/a><\/p>\n","protected":false},"author":60,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,4],"tags":[26],"class_list":["post-39095","post","type-post","status-publish","format-standard","hentry","category-blogs","category-syndicated","tag-sin-categoria"],"_links":{"self":[{"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/posts\/39095","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/users\/60"}],"replies":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/comments?post=39095"}],"version-history":[{"count":3,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/posts\/39095\/revisions"}],"predecessor-version":[{"id":42028,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/posts\/39095\/revisions\/42028"}],"wp:attachment":[{"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/media?parent=39095"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/categories?post=39095"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2016\/wp-json\/wp\/v2\/tags?post=39095"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}