diff options
author | ven <vendethiel@hotmail.fr> | 2016-02-29 09:41:00 +0100 |
---|---|---|
committer | ven <vendethiel@hotmail.fr> | 2016-02-29 09:41:00 +0100 |
commit | 46d36132cd3d2c87d78e8689cdddd5bcba656a0e (patch) | |
tree | 66587447ce096e13093d16a82cf6aa8c9b55d8ee /pythonstatcomp.html.markdown | |
parent | 326fa410fae93dc0f4767444759042515d7c28d5 (diff) | |
parent | ecba01b4b1c35cbcf58c5e030b9e79a5c30be55c (diff) |
Merge pull request #2166 from BraxtonFair/patch-1
Write a bit better code
Diffstat (limited to 'pythonstatcomp.html.markdown')
-rw-r--r-- | pythonstatcomp.html.markdown | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/pythonstatcomp.html.markdown b/pythonstatcomp.html.markdown index f8d83b98..0b02dca8 100644 --- a/pythonstatcomp.html.markdown +++ b/pythonstatcomp.html.markdown @@ -150,9 +150,8 @@ ggplot(aes(x="age",y="weight"), data=pets) + geom_point() + labs(title="pets") url = "https://raw.githubusercontent.com/e99n09/R-notes/master/data/hre.csv" r = requests.get(url) fp = "hre.csv" -f = open(fp, "wb") -f.write(r.text.encode("UTF-8")) -f.close() +with open(fp, "wb") as f: + f.write(r.text.encode("UTF-8")) hre = pd.read_csv(fp) |