Skip to content

Commit

Permalink
all
Browse files Browse the repository at this point in the history
  • Loading branch information
ajinra020307 committed Oct 26, 2019
1 parent 60100d4 commit dbd9aea
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 0 deletions.
4 changes: 4 additions & 0 deletions 23.tryexept.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
try:
age=int(input(('enter your age')))
except:
print('error')
11 changes: 11 additions & 0 deletions 24.class.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class Rectangle:
def __init__(self,length,breadth):
self.length=length
self.breadth=breadth

def area(self):
return self.length*self.breadth


r1=Rectangle(20,30)
print(r1.area())
12 changes: 12 additions & 0 deletions 25.inheritance.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class Mammal:
def walk(self):
print('i can wak')

class Dog(Mammal):
pass

class Cat(Mammal):
pass

c=Cat()
c.walk()
7 changes: 7 additions & 0 deletions 25.modules.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import module

module.function(arguments)

from module import function

function(arguments)
24 changes: 24 additions & 0 deletions 27.pathmodule.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from pathlib import Path

p=Path('../../Desktop')
print(p.exists())

#return true or false based on the result
#making a dir

#p1=Path('dd')
#p1.mkdir()

#deleting a dir

p2=Path('dd')
p2.rmdir()

#searching for a file or multiple file
p3=Path()

#p3.glob(*.py) returns a generater object we can itterate

for file in p3.glob('*.py'):
print(file)

1 change: 1 addition & 0 deletions projects/scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from bs4 import BeautifulSoup

r=requests.get(url='https://ajin.netlify.com')

data=BeautifulSoup(r.content,'html.parser')
data=str(data)
file=open('scrappeddata.html','w+')
Expand Down

0 comments on commit dbd9aea

Please sign in to comment.