Last active
December 17, 2015 16:18
-
-
Save hj91/5637358 to your computer and use it in GitHub Desktop.
This gist is an example of opening a file in read only mode, reading its contents and manipulating some standard string functions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a=open("text1.txt","r") | |
b=[] | |
for i in a.readlines(): | |
b.append(i) | |
if b.__contains__("hello"): | |
print "Yes" | |
else: | |
print "No" | |
for j in b: | |
print b.strip("\n") | |
a.close() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hello | |
harshad | |
random |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment