Skip to content

Conversation

eransevil
Copy link

@eransevil eransevil commented Nov 28, 2019

Here is our script @MayaGreenbaum

thanks @AviadP

@@ -0,0 +1,9 @@
file_object =open("a.txt","r")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When opening file it is mandatory to close it when its no longer needed. you can use "close" method, but better implementation would be to use "with...open"

@@ -0,0 +1,9 @@
file_object =open("a.txt","r")
data=file_object.read().split()
dict = {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not use "dict" as variable name, and as general guideline - var names need to be clear and meaningful

file_object =open("a.txt","r")
data=file_object.read().split()
dict = {}
for i in data:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again, in python we are not using 'i' as var name.

@@ -0,0 +1,9 @@
file_object =open("a.txt","r")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better to use full path instead of file name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants