-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
This is rakesh and this is my first file handling program in Python | ||
This is second line and i am learning new things in pythinthird line of the same program |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#program to create Text File using Python | ||
# made by : rakesh kumar | ||
# Last Compiled on : 7/7/2018 | ||
|
||
file = open("Testing.txt","w") | ||
file.write("This is rakesh and this is my first file handling program in Python \n") | ||
file.write("This is second line and i am learning new things in pythin") | ||
file.writelines("third line of the same program") | ||
file.close() | ||
print("File Generated please check") |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#program to find out total number of "Project" word in any given test file | ||
#made by : rakesh kumar | ||
# made on : 07/07/2018 | ||
|
||
file = open(r"abcd.txt",'r') | ||
count=0; | ||
for line in file.readlines(): | ||
if line[0]=='T': | ||
count+=1 | ||
file.close() | ||
print("Total lines that start with alphabet 'T' :",count) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#program to find out total number of "Project" word in any given test file | ||
#made by : rakesh kumar | ||
# made on : 07/07/2018 | ||
|
||
file = open(r"abcd.txt",'r') | ||
words=lines=0 | ||
for line in file.readlines(): | ||
lines+=1 | ||
words+=len(line.split()) | ||
file.close() | ||
print("Total Words in this File :",words) | ||
print("Total Lines in this File :",lines) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
file = open(r"C:\Users\acer\Desktop\PythonBox\pythonPrograms\fileHandling\abcd.txt",'r') | ||
file = open(r"abcd.txt",'r') | ||
data1 = file.read() | ||
print(data1) | ||
file.close() |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#program to find out total number of "Project" word in any given test file | ||
#made by : rakesh kumar | ||
# made on : 07/07/2018 | ||
|
||
file = open(r"abcd.txt",'r') | ||
count=0; | ||
for line in file.readlines(): | ||
if "Project" in line.split(): | ||
count+=1 | ||
file.close() | ||
print("Total 'Project' term available :",count) |