Skip to content

Commit 5dc9912

Browse files
Adding set of files for python Batch 1
1 parent 5d1bddd commit 5dc9912

File tree

104 files changed

+2530
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+2530
-0
lines changed

.idea/.gitignore

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/PythonFullStack_Examples.iml

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/inspectionProfiles/profiles_settings.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Built-In-Module/csv_module.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import csv
2+
3+
with open("C:/Users/Mahesh Gavandar/OneDrive/Desktop/Book1.csv","r") as file:
4+
read_file=csv.DictReader(file)
5+
#for read1 in read_file:
6+
# print(read1["Name"])
7+
8+
read_f=csv.reader(file)
9+
for r in read_f:
10+
print(r[1])
11+
12+
13+
data=[
14+
["Name","Age","Result"],
15+
["Praddep","31","Pass"],
16+
["Prashant","10","Fail"],
17+
]
18+
with open("student_status.csv","w",newline="") as file:
19+
writer=csv.writer(file)
20+
writer.writerows(data)
21+
writer.writerow(("Sagar","32","Pass"))

Built-In-Module/datetime_module.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import datetime
2+
3+
print(f"Print Current Date and Time : ",datetime.datetime.now())
4+
print(f"Print Todays Date : ",datetime.datetime.today())
5+
dt=datetime.datetime.now()
6+
print("Hour:",dt.hour, "Minute:", dt.minute,"Second:", dt.second,"Microsecond",dt.microsecond)
7+
print("Day:",dt.day,"Month:",dt.month,"Year",dt.year)
8+
9+
print("Customize Date:",datetime.date(2023,2,2))
10+
print("Customize Time: ",datetime.time(10,10,10))
11+
12+
print(dt.strftime("%m-%d-%Y %H:%M:%S %A %B"))
13+
14+
print(datetime.datetime.now() + datetime.timedelta(days=30))
15+
16+

Built-In-Module/json_module.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import json
2+
student=[{
3+
"name":"Pradeep",
4+
"Age":24,
5+
"Address":"Pune",
6+
"Marks":{
7+
"Math":90,
8+
"English":100
9+
}
10+
},
11+
{
12+
"name":"Sagar",
13+
"Age":20,
14+
"Address":"Mumbai"
15+
}]
16+
17+
#for li in student:
18+
# print(li["name"])
19+
20+
21+
jsondata1=json.dumps(student,indent=4)
22+
with open("student_data.json","w") as file:
23+
file.write(jsondata1)
24+
25+
26+
with open("student_data.json","r") as file:
27+
date_obj=json.load(file)
28+
for li in date_obj:
29+
if "Marks" in li:
30+
print(li["Marks"])
31+
32+
json_string='{"name":"Pradeep","Roll":"1","Address":"Pune"}'
33+
json_obj=json.loads(json_string)
34+
#print(type(json_obj))
35+

Built-In-Module/jsonfile.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"Address": "Pune",
3+
"Name": "Mahesh",
4+
"Roll": 2
5+
}

0 commit comments

Comments
 (0)