Skip to content

Commit

Permalink
new programs
Browse files Browse the repository at this point in the history
  • Loading branch information
26rudra committed Sep 4, 2022
1 parent 8f785e4 commit 6888a9d
Show file tree
Hide file tree
Showing 10 changed files with 466 additions and 0 deletions.
9 changes: 9 additions & 0 deletions api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from bs4 import BeautifulSoup
import requests
url=("https://www.regexsoftware.com/")
data = requests.get(url).text
soup = BeautifulSoup(data,"lxml")
#print(soup.prettify)
for div_tag in soup.find_all("div",{"class":"elementor-element elementor-element-9ba7258 elementor-column elementor-col-25 elementor-top-column"}):
for div_data in div_tag.find_all("div",{"class":"elementor-heading-title elementor-size-default"}):
print(div_data)
29 changes: 29 additions & 0 deletions newprojectaws/S3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import boto3
import time
import datetime
import random

while True:
time.sleep(10)
resource=boto3.resource("s3")



ts=time.time()

bucket=resource.Bucket(f"mynewbucket{ts}")
response = bucket.create(
ACL='public-read-write',
CreateBucketConfiguration={
'LocationConstraint': 'ap-south-1'
},)
s=random.randint(0,10)
with open('/newprojectaws', 'w') as data:
resource.Bucket(f'mynewbucket{ts}').upload_file('/newprojectaws', f'newfile{s}')







9 changes: 9 additions & 0 deletions newprojectaws/newtest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from importlib.resources import Resource
import boto3

resource=boto3.resource('s3')
list_=resource.buckets.all()
for buckets in list_:
print(buckets.name)
for my_bucket_object in resource.objects.all():
print(my_bucket_object)
50 changes: 50 additions & 0 deletions newprojectaws/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# s3 = boto3.resource('s3')
# the_bucket = s3.Bucket('my_bucket')

from asyncio.windows_events import NULL
from http import client
from re import X
import boto3
import time
import datetime
import random
import botocore
s3= boto3.resource('s3')
the_bucket = s3.buckets.all()
for bucket in the_bucket:
# print(bucket.name)
N=bucket.name
my_bucket=s3.Bucket(bucket.name)
# response= resource.list_objects_v2(bucket.name)

# list_=(map(lambda x: (x.bucket_name, x.key), my_bucket.objects.all()))
# listkeys=my_bucket.bucket_name()

# print(listkeys)
for keys in my_bucket.objects.all():
list_= (keys.bucket_name)

for keys in the_bucket :
list_2=(keys.name)
print(list_2)
# for i in list_:
# print(i)
# list_=filter(None,list(list_))
for i in list_2:
if i not in list_:
response=s3.delete(i)

# print(list_)
# else:
# my_bucket.delete_bucket(list_[0])
#

# # list2=list(filter(None,list_))
# for i in list_:
# if len(list_)<1:
# continue
# my_bucket.delete_bucket(list2[0])
# if my_bucket.all()
# else:
# print(list_[0])

51 changes: 51 additions & 0 deletions newprojectaws/time.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
from asyncio.windows_events import NULL
from http import client
from importlib.resources import Resource
from re import X


import boto3
import time
import datetime
import random
import botocore
resource = boto3.resource('s3')
response = resource.buckets.all()
for bucket in response:
# print(bucket.name)
N=bucket.name
my_bucket=resource.Bucket(bucket.name)
# response= resource.list_objects_v2(bucket.name)

# list_=(map(lambda x: (x.bucket_name, x.key), my_bucket.objects.all()))
# listkeys=my_bucket.bucket_name()

# print(listkeys)
for keys in resource.Object.all():
list_= (keys.bucket_name)

for keys in response :
list_2=(keys.name)
print(list_2)
# for i in list_:
# print(i)
# list_=filter(None,list(list_))
for i in list_2:
if i not in list_:
bucket=response.Bucket("nonamebuckt9898")
response = bucket.delete()

# print(list_)
# else:
# my_bucket.delete_bucket(list_[0])
#

# # list2=list(filter(None,list_))
# for i in list_:
# if len(list_)<1:
# continue
# my_bucket.delete_bucket(list2[0])
# if my_bucket.all()
# else:
# print(list_[0])

97 changes: 97 additions & 0 deletions practicebro1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# print("I love to play football")
# print("I can play it anytime") 1
# first_name = "bro"
# second_name = "code"
# full_name = first_name + " " + second_name
# print("hello "+full_name) #2
# print(type(name))
# age = 21
# age += 1
# print("your age is : "+str(age))
# print(age)
# print(type(age))
# height = 150.5
# print("your height is : "+str(height))
# print(type(height))
# human = True
# print(type(human))
# print("are you a human : "+str(human)) #time:17:01

# MULTIPLE ASSIGNMENT BY BRO CODE (18:04)
# name , age , attractive = "rudraksh" , 20 , True
# print(name)
# print(age)
# print(attractive) # if all elements have similar value then below:
# gopu = muniya = raghav = chotu = 20
# print(gopu)
# print(raghav)
# print(muniya)
# print(chotu)
# name = "rudraksh bohra" #len function also counts spaces so instead of 13 it's going to print 14
# print(len(name))
# print(name.find("r")) # find function only gives the index of first element to be found for eg i there are 3 r then it will give the index of first r to be found
# print(name.capitalize()) # it will not capitalize the word after space
# print(name.upper()) # will convert into upper case similarly we can use .lower
# print(name.isdigit()) #return true if our string is numeric value else false
# print(name.isalpha()) # if there is alphabets in string then true but if there is space between two alphabets then it will return false
# print(name.count("r")) #prints the count of characters within our string
# print(name.replace("r","m")) # if we want to replace certain character with other character
# print(name*3) #if we want to print name multiple times

#TYPECASTING IN PYTHON 25:22
# x = 1 #int
# y = 2.0 #float
# z = "3" #str
# y = int(y) #this is permanent tye cast in which if we print y we will get it value 2
# print(x)
# print(int(y)) # this is not permanent typecast
# print(z)
# print("x is "+z)
# print("x is "+x) #it will print error so we have to typecast int and float value in string value in this situation

#HOW WE CAN ACCEPT SOME USER INPUT IN PYTHON(31:00)
# name = input("what is your name?: ")
# age = int(input("how old are you?: "))
# height = float(input("how tall are you?: "))
# age = age + 1
# print("Hello "+name)
# print("you are "+str(age)+" year old")
# print("you are "+str(height)+"cm tall")

#USEFUL FUNCTIONS RELATED TO NUMBERS IN PYTHON(37:09)
# import math
# pi = 3.14 # "import math" to access these functions
# print(round(pi))
# print(math.ceil(pi)) # use to rounded up for the particular value
# print(math.floor(pi)) #rounded down for the particular value
# print(abs(pi)) #give the absolute value i.e. how much the value is far from zero
# print(pow(pi, 2)) #print the power of any certain value
# print(math.sqrt(pi)) # to find the square root of any value
# x = 1
# y = 2
# z = 3
# print(max(x,y,z)) # print the maximum of these values
# print(min(x,y,z)) # min for lowest

#STRING SLICING IN PYTHON(41:05) slicing creates a substring by extracting elements from another string
# two ways by indexing[] or by slice() function [start:stop:step]
# name = "rudraksh bohra"
# first_name = name[0:8] #can also be done by name[:8] , empty space will take default start value
# print(first_name)
# second_name = name[9:14] # can also be done by name[9:] , default stop value
# print(second_name)
# funky_name = name[13:-15:-1] # we can also do it by name[::-1] or name[13::-1]
# print(funky_name)
# print(name[::2])
#STRING SLICING USING SLICE FUNCTION
# website1 = "http://google.com"
# website2 = "http://linkedIn.com"

# slice = slice(7,-4)

# print(website1[slice])
# print(website2[slice])




29 changes: 29 additions & 0 deletions q1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@


import math


def digSum( n):
sum = 0

while(n > 0 or sum > 9):

if(n == 0):
n = sum
sum = 0

sum += n % 10
n /= 10

return sum

# Driver method
n = input("enter number: ")
x=n.split(" ")
q=x[0]
w=x[1]
if ((int(digSum(int(q))))== (int(digSum(int(w))))):
print(True)
else:
print(False)

11 changes: 11 additions & 0 deletions q2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from collections import Counter
x=input()
l1=[]
for i in range(int(x)):

l1.add[i]
d = Counter(l1)
print(d)

new_list = list([item for item in d if d[item]>1])
print(new_list)
Loading

0 comments on commit 6888a9d

Please sign in to comment.