File tree Expand file tree Collapse file tree 5 files changed +1885
-0
lines changed Expand file tree Collapse file tree 5 files changed +1885
-0
lines changed Original file line number Diff line number Diff line change
1
+ def valid_rgb (rgb ):
2
+ #check if rgb input tuple is within 0-255
3
+ for val in rgb :
4
+ if not 0 <= val <= 255 :
5
+ return False
6
+ return True
7
+
8
+
9
+ # print(valid_rgb((255, 100, 255)))
10
+ # print(valid_rgb((255, 100, 256)))
11
+
12
+ def valid_rgb (rgb ):
13
+ #check if rgb input tuple is within 0-255
14
+ valid = [
15
+ 0 <= val <= 255
16
+ for val in rgb
17
+ ]
18
+ return all (valid )
19
+
20
+ # print(valid_rgb((255, 100, 255)))
21
+ # print(valid_rgb((255, 100, 256)))
22
+
23
+
24
+ def valid_rgb (rgb ):
25
+ #check if rgb input tuple is within 0-255
26
+ return all (
27
+ 0 <= val <= 255
28
+ for val in rgb
29
+ )
30
+
31
+ # print(valid_rgb((255, 100, 255)))
32
+ # print(valid_rgb((255, 100, 256)))
33
+
34
+
35
+ def contains_numbers (input ):
36
+ for char in input :
37
+ if char .isdigit ():
38
+ return True
39
+ return False
40
+
41
+ print (contains_numbers ('one is done' ))
42
+ print (contains_numbers ('1 is done' ))
43
+
44
+ def contains_numbers (input ):
45
+ return any (char .isdigit ()
46
+ for char in input
47
+ )
48
+
49
+ print (contains_numbers ('one is done' ))
50
+ print (contains_numbers ('1 is done' ))
Original file line number Diff line number Diff line change
1
+ import requests as re
2
+ for i in range (1 , 3 ):
3
+ img_data = re .get (f'https://www.litres.ru/pages/get_pdf_page/?file=98856895&page={ i } &rt=w1900&ft=gif' ).content
4
+ with open (f'page{ i } .gif' , 'wb' ) as handler :
5
+ handler .write (img_data )
You can’t perform that action at this time.
0 commit comments