File tree 4 files changed +42
-8
lines changed
4 files changed +42
-8
lines changed Original file line number Diff line number Diff line change @@ -43,3 +43,11 @@ def student_info(*args, **kwargs):
43
43
# print(**info)
44
44
45
45
student_info (* courses , ** info )
46
+
47
+
48
+ def hello_func (greeting , name = "you" ):
49
+ return "{}, {}" .format (greeting , name )
50
+
51
+
52
+ print (hello_func ("hello" ))
53
+ print (hello_func ("hello" , "Corey" ))
Original file line number Diff line number Diff line change 1
1
import sys
2
2
3
- # not the best way to add path
3
+ # not the best way to add module path
4
4
sys .path .append ("d:\\ code_snippets\\ Python-Imports\\ modules" )
5
5
6
+ # in windows https://stackoverflow.com/questions/3701646/how-to-add-to-the-pythonpath-in-windows-so-it-finds-my-modules-packages
7
+
8
+
9
+ # this is the path, where python will look for modules to import
6
10
print (sys .path )
7
11
8
12
# import my_module as mm
9
13
10
14
from my_module import find_index as fi , test
11
15
12
-
13
- # from my_module import * dont do that
16
+ # dont do that, because we have hard time to know where the funtions come from
17
+ # from my_module import *
14
18
15
19
courses = ["History" , "Math" , "Physics" , "CompSci" ]
16
20
17
21
# index = mm.find_index(courses, "Math")
18
22
index = fi (courses , "History" )
19
23
20
- print (index )
24
+ print ("find history" , index )
21
25
22
26
print (test )
23
-
24
- # this is the path, where python will look for modules to import
25
- print (sys .path )
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ pip list -o
4
4
pip list --outdated
5
5
6
6
7
-
7
+ # give someone a lit of all the packages
8
8
pip freeze > requirements.txt
9
9
10
10
pip install -r requirements.txt
Original file line number Diff line number Diff line change
1
+ https://www.youtube.com/watch?v=N5vscPTWKOk&list=PL-osiE80TeTt2d9bfVyTiXJA-UTHn6WwU&index=14
2
+
3
+ pip list
4
+ pip list -o
5
+
6
+ pip install virtualenv
7
+
8
+
9
+ cd any folder
10
+
11
+ virtualenv project_1
12
+
13
+ project_1\Scripts\activate
14
+
15
+ deactivate
16
+
17
+ #export modules
18
+ pip freeze --local > requirements.txt
19
+
20
+ virtualenv project_2
21
+
22
+ project_2\Scripts\activate
23
+
24
+ #import modules
25
+ pip install -r requirements.txt
You can’t perform that action at this time.
0 commit comments