Warning: The magic method Slickr_Flickr_Plugin::__wakeup() must have public visibility in /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php on line 152

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831
{"id":28430,"date":"2015-11-25T23:18:52","date_gmt":"2015-11-26T05:18:52","guid":{"rendered":"http:\/\/charliegdrummer.wordpress.com\/?p=444"},"modified":"2015-11-25T23:18:52","modified_gmt":"2015-11-26T05:18:52","slug":"mastery-30-files","status":"publish","type":"post","link":"https:\/\/kenscourses.com\/tc101fall2015\/2015\/mastery-30-files\/","title":{"rendered":"Mastery 30: Files"},"content":{"rendered":"

In terms of files external files to python, such as dat, text, cvs… files, the command that you use to open them is……………….. OPEN!!!!<\/p>\n

open(“filename.extension”,”r or w”)<\/p>\n

You put r if you are going to read the file<\/p>\n

You put w if you want to write the file<\/p>\n

There are others parameter you can type there, but those are the basics<\/p>\n

So let’s start, I am going to use the 93car.dat.tx the Journal of Statistics Education gives us.<\/p>\n

What I want to do, is to delete all those strange number to only left the brand of the car and rthe model<\/p>\n

See the original file:<\/p>\n

\"original<\/p>\n

And how I want it to end:<\/p>\n

\"desired<\/p>\n

So let’s start<\/p>\n

The first thing to do is to open the file in reading mode (that means r at the end of the parenthesis) \u00a0and to store aaaaalll the data inside a variable inside python, I called it text, after that close it.<\/p>\n

\"open<\/p>\n

Then I will open the file in writing mode to start modifying it, so first, I have to get rid of the even lines.<\/p>\n

\"open<\/p>\n

One way te start reading and changing the lines is with a for loop<\/p>\n

for (any variable, I chose line) in (where you stored all the data, in my case is text)<\/p>\n

for line in text:<\/p>\n

That is the main loop, and since I want to get rid of the even lines, I am going to write the lines only if is even BEACUSE we count the first iteration as one, see that x?<\/p>\n<\/p>\n

after doing that, close it!<\/p>\n

open your file, and you are going to see….. YES!<\/p>\n

\"middle.PNG\"<\/p>\n

You have just modified your first file from python!<\/p>\n

Now, I don like all those number, so I want to errase them, I know all these numbers start on the position number 30 en every line, so starting over and doing the same process EXCEPT what is inside the for.<\/p>\n

\"start<\/p>\n

You see, what we are going to do inside the for loop is to write each line, but cutted; you see that [0:29]? that means that it is only going to write from the first space to the 29th of each line<\/p>\n

\"just<\/p>\n

And now open your file…. and it has to look like this, you did it!<\/p>\n

 <\/p>\n

\"asdfas\"<\/p>\n

As you can see, it is very easy, you just write up what you want<\/p>\n

 <\/p>\n

Github link<\/a><\/span><\/p>\n

 <\/p>\n

\"b1e0b19965f87e7b83b66070e394bb33\"<\/p>\n

\"\"<\/a> \"\"<\/p>\n","protected":false},"excerpt":{"rendered":"

In terms of files external files to python, such as dat, text, cvs… files, the command that you use to open them is……………….. OPEN!!!! open(“filename.extension”,”r or w”) You put r if you are going to read the file You put w if you want to … Continúa leyendo Mastery 30: Files<\/span><\/a>\"\"<\/p>\n","protected":false},"author":191,"featured_media":28419,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,3],"tags":[431,45,39],"_links":{"self":[{"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/posts\/28430"}],"collection":[{"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/users\/191"}],"replies":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/comments?post=28430"}],"version-history":[{"count":1,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/posts\/28430\/revisions"}],"predecessor-version":[{"id":28431,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/posts\/28430\/revisions\/28431"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/media\/28419"}],"wp:attachment":[{"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/media?parent=28430"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/categories?post=28430"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101fall2015\/wp-json\/wp\/v2\/tags?post=28430"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}