-
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
10 changed files
with
56 additions
and
27 deletions.
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
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
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,18 +1,18 @@ | ||
# program to create a binary file of records - Just like structure | ||
# made by : rakesh kumar | ||
# Compiled on : 8-July-2018 | ||
# Compiled on : 27-Nov-2019 | ||
|
||
import pickle | ||
list =[] | ||
list = [] | ||
while True: | ||
roll = input("Enter student Roll No:") | ||
sname = input("Enter student Name :") | ||
student = {"roll":roll,"name":sname} | ||
sname = input("Enter student Name :") | ||
student = {"roll": roll, "name": sname} | ||
list.append(student) | ||
choice= input("Want to add more record(y/n) :") | ||
if(choice=='n'): | ||
choice = input("Want to add more record(y/n) :") | ||
if(choice == 'n'): | ||
break | ||
|
||
file = open("student.dat","wb") | ||
pickle.dump(list,file) | ||
file.close() | ||
file = open("student.dat", "wb") | ||
pickle.dump(list, file) | ||
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
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,6 @@ | ||
import os | ||
import glob | ||
|
||
for root, folders, files in os.walk(os.getcwd()): | ||
files = glob.glob(files + '/*.py') | ||
print(files) |
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
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,9 +1,10 @@ | ||
#program to read a binary file of records - Just like structure | ||
# program to read a binary file of records - Just like structure | ||
# made by : rakesh kumar | ||
# Compiled on : 8-July-2018 | ||
|
||
import pickle | ||
file = open("student.dat","rb") | ||
|
||
file = open("student.dat", "rb") | ||
list = pickle.load(file) | ||
print(list) | ||
file.close() | ||
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,6 @@ | ||
import re | ||
|
||
file = open("abcd.txt") | ||
data = file.read() | ||
data = re.sub('[ \t\n]+', ' ', data) | ||
print(data) |
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,17 @@ | ||
# program to read a binary file of records - Just like structure | ||
# made by : rakesh kumar | ||
# Compiled on : 8-July-2018 | ||
|
||
import pickle | ||
|
||
name = input('Enter name that you want to search in binary file :') | ||
|
||
file = open("student.dat", "rb") | ||
list = pickle.load(file) | ||
file.close() | ||
|
||
found = 0 | ||
for x in list: | ||
if name in x['name']: | ||
found = 1 | ||
print("Found in binary file" if found == 1 else "Not found") |
Binary file not shown.