mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-25 00:06:47 +03:00
[python/*] proofread en and ru and all links
This commit is contained in:
parent
cbb2eb4f00
commit
1924d58159
@ -1003,14 +1003,11 @@ print(say(say_please=True)) # Can you buy me a beer? Please! I am poor :(
|
|||||||
### مجانا عبر الانترنت
|
### مجانا عبر الانترنت
|
||||||
|
|
||||||
* [أتمتتة المهمات المُملة عبر بايثون](https://automatetheboringstuff.com)
|
* [أتمتتة المهمات المُملة عبر بايثون](https://automatetheboringstuff.com)
|
||||||
* [أفكار لمشروعات بلغة البايثون](http://pythonpracticeprojects.com)
|
|
||||||
* [التوثيقات الرسمية](http://docs.python.org/3/)
|
* [التوثيقات الرسمية](http://docs.python.org/3/)
|
||||||
* [دليل المُسافر لبايثون](http://docs.python-guide.org/en/latest/)
|
* [دليل المُسافر لبايثون](http://docs.python-guide.org/en/latest/)
|
||||||
* [دورة بايثون](http://www.python-course.eu/index.php)
|
* [دورة بايثون](http://www.python-course.eu/index.php)
|
||||||
* [أولى الخطوات مع بايثون](https://realpython.com/learn/python-first-steps/)
|
* [أولى الخطوات مع بايثون](https://realpython.com/learn/python-first-steps/)
|
||||||
* [قائمة مُختارة من إطارات عمل بايثون الرائعة, المكتبات والبرمجيات](https://github.com/vinta/awesome-python)
|
* [قائمة مُختارة من إطارات عمل بايثون الرائعة, المكتبات والبرمجيات](https://github.com/vinta/awesome-python)
|
||||||
* [ثلاثون خاصية وخدعة للغة البايثون ربما لم تعرف بها](http://sahandsaba.com/thirty-python-language-features-and-tricks-you-may-not-know.html)
|
* [الدليل الرسمي لنمط البايثون](https://peps.python.org/pep-0008/)
|
||||||
* [الدليل الرسمي لنمط البايثون](https://www.python.org/dev/peps/pep-0008/)
|
|
||||||
* [بايثون 3 دوائر علوم الحاسب](http://cscircles.cemc.uwaterloo.ca/)
|
* [بايثون 3 دوائر علوم الحاسب](http://cscircles.cemc.uwaterloo.ca/)
|
||||||
* [غُص في بايثون 3](http://www.diveintopython3.net/index.html)
|
* [غُص في بايثون 3](http://www.diveintopython3.net/index.html)
|
||||||
* [دورة سريعة في البايثون للعلماء](http://nbviewer.jupyter.org/gist/anonymous/5924718)
|
|
||||||
|
@ -631,8 +631,7 @@ print(say(say_please=True)) # Can you buy me a beer? Please! I am poor :(
|
|||||||
* [Dive Into Python](http://www.diveintopython.net/)
|
* [Dive Into Python](http://www.diveintopython.net/)
|
||||||
* [Ideas for Python Projects](http://pythonpracticeprojects.com)
|
* [Ideas for Python Projects](http://pythonpracticeprojects.com)
|
||||||
* [The Official Docs](http://docs.python.org/3/)
|
* [The Official Docs](http://docs.python.org/3/)
|
||||||
* [Hitchhiker's Guide to Python](http://docs.python-guide.org/en/latest/)
|
* [Hitchhiker's Guide to Python](http://docs.python-guide.org/)
|
||||||
* [A Crash Course in Python for Scientists](http://nbviewer.ipython.org/5920182)
|
|
||||||
* [Python Course](http://www.python-course.eu/index.php)
|
* [Python Course](http://www.python-course.eu/index.php)
|
||||||
* [First Steps With Python](https://realpython.com/learn/python-first-steps/)
|
* [First Steps With Python](https://realpython.com/learn/python-first-steps/)
|
||||||
|
|
||||||
|
@ -1015,12 +1015,10 @@ print(say(say_please=True)) # Can you buy me a beer? Please! I am poor :(
|
|||||||
* [Automate the Boring Stuff with Python](https://automatetheboringstuff.com)
|
* [Automate the Boring Stuff with Python](https://automatetheboringstuff.com)
|
||||||
* [Ideas for Python Projects](http://pythonpracticeprojects.com)
|
* [Ideas for Python Projects](http://pythonpracticeprojects.com)
|
||||||
* [The Official Docs](http://docs.python.org/3/)
|
* [The Official Docs](http://docs.python.org/3/)
|
||||||
* [Hitchhiker's Guide to Python](http://docs.python-guide.org/en/latest/)
|
* [Hitchhiker's Guide to Python](http://docs.python-guide.org/)
|
||||||
* [Python Course](http://www.python-course.eu/index.php)
|
* [Python Course](http://www.python-course.eu/index.php)
|
||||||
* [First Steps With Python](https://realpython.com/learn/python-first-steps/)
|
* [First Steps With Python](https://realpython.com/learn/python-first-steps/)
|
||||||
* [A curated list of awesome Python frameworks, libraries and software](https://github.com/vinta/awesome-python)
|
* [A curated list of awesome Python frameworks, libraries and software](https://github.com/vinta/awesome-python)
|
||||||
* [30 Python Language Features and Tricks You May Not Know About](http://sahandsaba.com/thirty-python-language-features-and-tricks-you-may-not-know.html)
|
* [Official Style Guide for Python](https://peps.python.org/pep-0008/)
|
||||||
* [Official Style Guide for Python](https://www.python.org/dev/peps/pep-0008/)
|
|
||||||
* [Python 3 Computer Science Circles](http://cscircles.cemc.uwaterloo.ca/)
|
* [Python 3 Computer Science Circles](http://cscircles.cemc.uwaterloo.ca/)
|
||||||
* [Dive Into Python 3](http://www.diveintopython3.net/index.html)
|
* [Dive Into Python 3](http://www.diveintopython3.net/index.html)
|
||||||
* [A Crash Course in Python for Scientists](http://nbviewer.jupyter.org/gist/anonymous/5924718)
|
|
||||||
|
@ -562,9 +562,8 @@ print(decir(decir_por_favor=True)) # ¿Puedes comprarme una cerveza? ¡Por favo
|
|||||||
* [Dive Into Python](http://www.diveintopython.net/)
|
* [Dive Into Python](http://www.diveintopython.net/)
|
||||||
* [Ideas for Python Projects](http://pythonpracticeprojects.com)
|
* [Ideas for Python Projects](http://pythonpracticeprojects.com)
|
||||||
* [The Official Docs](http://docs.python.org/3/)
|
* [The Official Docs](http://docs.python.org/3/)
|
||||||
* [Hitchhiker's Guide to Python](http://docs.python-guide.org/en/latest/)
|
* [Hitchhiker's Guide to Python](http://docs.python-guide.org/)
|
||||||
* [Python Module of the Week](http://pymotw.com/3/)
|
* [Python Module of the Week](http://pymotw.com/3/)
|
||||||
* [A Crash Course in Python for Scientists](http://nbviewer.ipython.org/5920182)
|
|
||||||
|
|
||||||
### Encuadernados
|
### Encuadernados
|
||||||
|
|
||||||
|
@ -713,8 +713,7 @@ print(say(say_please=True)) # affiche Can you buy me a beer? Please! I am poor
|
|||||||
* [Dive Into Python](http://www.diveintopython.net/)
|
* [Dive Into Python](http://www.diveintopython.net/)
|
||||||
* [Ideas for Python Projects](http://pythonpracticeprojects.com)
|
* [Ideas for Python Projects](http://pythonpracticeprojects.com)
|
||||||
* [The Official Docs](http://docs.python.org/3/)
|
* [The Official Docs](http://docs.python.org/3/)
|
||||||
* [Hitchhiker's Guide to Python](http://docs.python-guide.org/en/latest/)
|
* [Hitchhiker's Guide to Python](http://docs.python-guide.org/)
|
||||||
* [A Crash Course in Python for Scientists](http://nbviewer.ipython.org/5920182)
|
|
||||||
* [Python Course](http://www.python-course.eu/index.php)
|
* [Python Course](http://www.python-course.eu/index.php)
|
||||||
* [First Steps With Python](https://realpython.com/learn/python-first-steps/)
|
* [First Steps With Python](https://realpython.com/learn/python-first-steps/)
|
||||||
|
|
||||||
|
@ -1002,12 +1002,10 @@ print(say(say_please=True)) # Puoi comprarmi una birra? Per favore! Sono povero
|
|||||||
* [Automate the Boring Stuff with Python](https://automatetheboringstuff.com)
|
* [Automate the Boring Stuff with Python](https://automatetheboringstuff.com)
|
||||||
* [Ideas for Python Projects](http://pythonpracticeprojects.com)
|
* [Ideas for Python Projects](http://pythonpracticeprojects.com)
|
||||||
* [The Official Docs](http://docs.python.org/3/)
|
* [The Official Docs](http://docs.python.org/3/)
|
||||||
* [Hitchhiker's Guide to Python](http://docs.python-guide.org/en/latest/)
|
* [Hitchhiker's Guide to Python](http://docs.python-guide.org/)
|
||||||
* [Python Course](http://www.python-course.eu/index.php)
|
* [Python Course](http://www.python-course.eu/index.php)
|
||||||
* [First Steps With Python](https://realpython.com/learn/python-first-steps/)
|
* [First Steps With Python](https://realpython.com/learn/python-first-steps/)
|
||||||
* [A curated list of awesome Python frameworks, libraries and software](https://github.com/vinta/awesome-python)
|
* [A curated list of awesome Python frameworks, libraries and software](https://github.com/vinta/awesome-python)
|
||||||
* [30 Python Language Features and Tricks You May Not Know About](http://sahandsaba.com/thirty-python-language-features-and-tricks-you-may-not-know.html)
|
* [Official Style Guide for Python](https://peps.python.org/pep-0008/)
|
||||||
* [Official Style Guide for Python](https://www.python.org/dev/peps/pep-0008/)
|
|
||||||
* [Python 3 Computer Science Circles](http://cscircles.cemc.uwaterloo.ca/)
|
* [Python 3 Computer Science Circles](http://cscircles.cemc.uwaterloo.ca/)
|
||||||
* [Dive Into Python 3](http://www.diveintopython3.net/index.html)
|
* [Dive Into Python 3](http://www.diveintopython3.net/index.html)
|
||||||
* [A Crash Course in Python for Scientists](http://nbviewer.jupyter.org/gist/anonymous/5924718)
|
|
||||||
|
@ -996,12 +996,10 @@ print(say(say_please=True)) # Can you buy me a beer? Please! I am poor :(
|
|||||||
* [Automate the Boring Stuff with Python](https://automatetheboringstuff.com)
|
* [Automate the Boring Stuff with Python](https://automatetheboringstuff.com)
|
||||||
* [Ideas for Python Projects](http://pythonpracticeprojects.com)
|
* [Ideas for Python Projects](http://pythonpracticeprojects.com)
|
||||||
* [The Official Docs](http://docs.python.org/3/)
|
* [The Official Docs](http://docs.python.org/3/)
|
||||||
* [Hitchhiker's Guide to Python](http://docs.python-guide.org/en/latest/)
|
* [Hitchhiker's Guide to Python](http://docs.python-guide.org/)
|
||||||
* [Python Course](http://www.python-course.eu/index.php)
|
* [Python Course](http://www.python-course.eu/index.php)
|
||||||
* [First Steps With Python](https://realpython.com/learn/python-first-steps/)
|
* [First Steps With Python](https://realpython.com/learn/python-first-steps/)
|
||||||
* [A curated list of awesome Python frameworks, libraries and software](https://github.com/vinta/awesome-python)
|
* [A curated list of awesome Python frameworks, libraries and software](https://github.com/vinta/awesome-python)
|
||||||
* [30 Python Language Features and Tricks You May Not Know About](http://sahandsaba.com/thirty-python-language-features-and-tricks-you-may-not-know.html)
|
* [Official Style Guide for Python](https://peps.python.org/pep-0008/)
|
||||||
* [Official Style Guide for Python](https://www.python.org/dev/peps/pep-0008/)
|
|
||||||
* [Python 3 Computer Science Circles](http://cscircles.cemc.uwaterloo.ca/)
|
* [Python 3 Computer Science Circles](http://cscircles.cemc.uwaterloo.ca/)
|
||||||
* [Dive Into Python 3](http://www.diveintopython3.net/index.html)
|
* [Dive Into Python 3](http://www.diveintopython3.net/index.html)
|
||||||
* [A Crash Course in Python for Scientists](http://nbviewer.jupyter.org/gist/anonymous/5924718)
|
|
||||||
|
@ -726,13 +726,11 @@ print(say(say_please=True)) # Você me paga uma cerveja? Por favor! Eu sou pobre
|
|||||||
* [Dive Into Python](http://www.diveintopython.net/)
|
* [Dive Into Python](http://www.diveintopython.net/)
|
||||||
* [Ideas for Python Projects](http://pythonpracticeprojects.com)
|
* [Ideas for Python Projects](http://pythonpracticeprojects.com)
|
||||||
* [The Official Docs](http://docs.python.org/3/)
|
* [The Official Docs](http://docs.python.org/3/)
|
||||||
* [Hitchhiker's Guide to Python](http://docs.python-guide.org/en/latest/)
|
* [Hitchhiker's Guide to Python](http://docs.python-guide.org/)
|
||||||
* [A Crash Course in Python for Scientists](http://nbviewer.ipython.org/5920182)
|
|
||||||
* [Python Course](http://www.python-course.eu/index.php)
|
* [Python Course](http://www.python-course.eu/index.php)
|
||||||
* [First Steps With Python](https://realpython.com/learn/python-first-steps/)
|
* [First Steps With Python](https://realpython.com/learn/python-first-steps/)
|
||||||
* [A curated list of awesome Python frameworks, libraries and software](https://github.com/vinta/awesome-python)
|
* [A curated list of awesome Python frameworks, libraries and software](https://github.com/vinta/awesome-python)
|
||||||
* [30 Python Language Features and Tricks You May Not Know About](http://sahandsaba.com/thirty-python-language-features-and-tricks-you-may-not-know.html)
|
* [Official Style Guide for Python](https://peps.python.org/pep-0008/)
|
||||||
* [Official Style Guide for Python](https://www.python.org/dev/peps/pep-0008/)
|
|
||||||
|
|
||||||
### Dead Tree
|
### Dead Tree
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ syntactic clarity. It's basically executable pseudocode.
|
|||||||
# Integer division rounds down for both positive and negative numbers.
|
# Integer division rounds down for both positive and negative numbers.
|
||||||
5 // 3 # => 1
|
5 // 3 # => 1
|
||||||
-5 // 3 # => -2
|
-5 // 3 # => -2
|
||||||
5.0 // 3.0 # => 1.0 # works on floats too
|
5.0 // 3.0 # => 1.0 # works on floats too
|
||||||
-5.0 // 3.0 # => -2.0
|
-5.0 // 3.0 # => -2.0
|
||||||
|
|
||||||
# The result of division is always a float
|
# The result of division is always a float
|
||||||
@ -74,36 +74,36 @@ True and False # => False
|
|||||||
False or True # => True
|
False or True # => True
|
||||||
|
|
||||||
# True and False are actually 1 and 0 but with different keywords
|
# True and False are actually 1 and 0 but with different keywords
|
||||||
True + True # => 2
|
True + True # => 2
|
||||||
True * 8 # => 8
|
True * 8 # => 8
|
||||||
False - 5 # => -5
|
False - 5 # => -5
|
||||||
|
|
||||||
# Comparison operators look at the numerical value of True and False
|
# Comparison operators look at the numerical value of True and False
|
||||||
0 == False # => True
|
0 == False # => True
|
||||||
2 > True # => True
|
2 > True # => True
|
||||||
2 == True # => False
|
2 == True # => False
|
||||||
-5 != False # => True
|
-5 != False # => True
|
||||||
|
|
||||||
# None, 0, and empty strings/lists/dicts/tuples/sets all evaluate to False.
|
# None, 0, and empty strings/lists/dicts/tuples/sets all evaluate to False.
|
||||||
# All other values are True
|
# All other values are True
|
||||||
bool(0) # => False
|
bool(0) # => False
|
||||||
bool("") # => False
|
bool("") # => False
|
||||||
bool([]) # => False
|
bool([]) # => False
|
||||||
bool({}) # => False
|
bool({}) # => False
|
||||||
bool(()) # => False
|
bool(()) # => False
|
||||||
bool(set()) # => False
|
bool(set()) # => False
|
||||||
bool(4) # => True
|
bool(4) # => True
|
||||||
bool(-6) # => True
|
bool(-6) # => True
|
||||||
|
|
||||||
# Using boolean logical operators on ints casts them to booleans for evaluation,
|
# Using boolean logical operators on ints casts them to booleans for evaluation,
|
||||||
# but their non-cast value is returned. Don't mix up with bool(ints) and bitwise
|
# but their non-cast value is returned. Don't mix up with bool(ints) and bitwise
|
||||||
# and/or (&,|)
|
# and/or (&,|)
|
||||||
bool(0) # => False
|
bool(0) # => False
|
||||||
bool(2) # => True
|
bool(2) # => True
|
||||||
0 and 2 # => 0
|
0 and 2 # => 0
|
||||||
bool(-5) # => True
|
bool(-5) # => True
|
||||||
bool(2) # => True
|
bool(2) # => True
|
||||||
-5 or 0 # => -5
|
-5 or 0 # => -5
|
||||||
|
|
||||||
# Equality is ==
|
# Equality is ==
|
||||||
1 == 1 # => True
|
1 == 1 # => True
|
||||||
@ -153,9 +153,9 @@ len("This is a string") # => 16
|
|||||||
|
|
||||||
# Since Python 3.6, you can use f-strings or formatted string literals.
|
# Since Python 3.6, you can use f-strings or formatted string literals.
|
||||||
name = "Reiko"
|
name = "Reiko"
|
||||||
f"She said her name is {name}." # => "She said her name is Reiko"
|
f"She said her name is {name}." # => "She said her name is Reiko"
|
||||||
# Any valid Python expression inside these braces is returned to the string.
|
# Any valid Python expression inside these braces is returned to the string.
|
||||||
f"{name} is {len(name)} characters long." # => "Reiko is 5 characters long."
|
f"{name} is {len(name)} characters long." # => "Reiko is 5 characters long."
|
||||||
|
|
||||||
# None is an object
|
# None is an object
|
||||||
None # => None
|
None # => None
|
||||||
@ -177,7 +177,7 @@ print("I'm Python. Nice to meet you!") # => I'm Python. Nice to meet you!
|
|||||||
print("Hello, World", end="!") # => Hello, World!
|
print("Hello, World", end="!") # => Hello, World!
|
||||||
|
|
||||||
# Simple way to get input data from console
|
# Simple way to get input data from console
|
||||||
input_string_var = input("Enter some data: ") # Returns the data as a string
|
input_string_var = input("Enter some data: ") # Returns the data as a string
|
||||||
|
|
||||||
# There are no declarations, only assignments.
|
# There are no declarations, only assignments.
|
||||||
# Convention in naming variables is snake_case style
|
# Convention in naming variables is snake_case style
|
||||||
@ -340,9 +340,8 @@ filled_dict["four"] = 4 # another way to add to dict
|
|||||||
del filled_dict["one"] # Removes the key "one" from filled dict
|
del filled_dict["one"] # Removes the key "one" from filled dict
|
||||||
|
|
||||||
# From Python 3.5 you can also use the additional unpacking options
|
# From Python 3.5 you can also use the additional unpacking options
|
||||||
{'a': 1, **{'b': 2}} # => {'a': 1, 'b': 2}
|
{"a": 1, **{"b": 2}} # => {'a': 1, 'b': 2}
|
||||||
{'a': 1, **{'a': 2}} # => {'a': 2}
|
{"a": 1, **{"a": 2}} # => {'a': 2}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Sets store ... well sets
|
# Sets store ... well sets
|
||||||
@ -374,10 +373,10 @@ filled_set | other_set # => {1, 2, 3, 4, 5, 6}
|
|||||||
{1, 2, 3, 4} ^ {2, 3, 5} # => {1, 4, 5}
|
{1, 2, 3, 4} ^ {2, 3, 5} # => {1, 4, 5}
|
||||||
|
|
||||||
# Check if set on the left is a superset of set on the right
|
# Check if set on the left is a superset of set on the right
|
||||||
{1, 2} >= {1, 2, 3} # => False
|
{1, 2} >= {1, 2, 3} # => False
|
||||||
|
|
||||||
# Check if set on the left is a subset of set on the right
|
# Check if set on the left is a subset of set on the right
|
||||||
{1, 2} <= {1, 2, 3} # => True
|
{1, 2} <= {1, 2, 3} # => True
|
||||||
|
|
||||||
# Check for existence in a set with in
|
# Check for existence in a set with in
|
||||||
2 in filled_set # => True
|
2 in filled_set # => True
|
||||||
@ -501,15 +500,15 @@ with open("myfile1.txt", "w") as file:
|
|||||||
|
|
||||||
import json
|
import json
|
||||||
with open("myfile2.txt", "w") as file:
|
with open("myfile2.txt", "w") as file:
|
||||||
file.write(json.dumps(contents)) # writes an object to a file
|
file.write(json.dumps(contents)) # writes an object to a file
|
||||||
|
|
||||||
# Reading from a file
|
# Reading from a file
|
||||||
with open('myfile1.txt', "r") as file:
|
with open("myfile1.txt") as file:
|
||||||
contents = file.read() # reads a string from a file
|
contents = file.read() # reads a string from a file
|
||||||
print(contents)
|
print(contents)
|
||||||
# print: {"aa": 12, "bb": 21}
|
# print: {"aa": 12, "bb": 21}
|
||||||
|
|
||||||
with open('myfile2.txt', "r") as file:
|
with open("myfile2.txt", "r") as file:
|
||||||
contents = json.load(file) # reads a json object from a file
|
contents = json.load(file) # reads a json object from a file
|
||||||
print(contents)
|
print(contents)
|
||||||
# print: {"aa": 12, "bb": 21}
|
# print: {"aa": 12, "bb": 21}
|
||||||
@ -662,9 +661,9 @@ def create_avg():
|
|||||||
return total/count
|
return total/count
|
||||||
return avg
|
return avg
|
||||||
avg = create_avg()
|
avg = create_avg()
|
||||||
avg(3) # => 3.0
|
avg(3) # => 3.0
|
||||||
avg(5) # (3+5)/2 => 4.0
|
avg(5) # (3+5)/2 => 4.0
|
||||||
avg(7) # (8+7)/3 => 5.0
|
avg(7) # (8+7)/3 => 5.0
|
||||||
|
|
||||||
# There are also anonymous functions
|
# There are also anonymous functions
|
||||||
(lambda x: x > 2)(3) # => True
|
(lambda x: x > 2)(3) # => True
|
||||||
@ -682,7 +681,7 @@ list(filter(lambda x: x > 5, [3, 4, 5, 6, 7])) # => [6, 7]
|
|||||||
[x for x in [3, 4, 5, 6, 7] if x > 5] # => [6, 7]
|
[x for x in [3, 4, 5, 6, 7] if x > 5] # => [6, 7]
|
||||||
|
|
||||||
# You can construct set and dict comprehensions as well.
|
# You can construct set and dict comprehensions as well.
|
||||||
{x for x in 'abcddeef' if x not in 'abc'} # => {'d', 'e', 'f'}
|
{x for x in "abcddeef" if x not in "abc"} # => {'d', 'e', 'f'}
|
||||||
{x: x**2 for x in range(5)} # => {0: 0, 1: 1, 2: 4, 3: 9, 4: 16}
|
{x: x**2 for x in range(5)} # => {0: 0, 1: 1, 2: 4, 3: 9, 4: 16}
|
||||||
|
|
||||||
|
|
||||||
@ -744,7 +743,7 @@ class Human:
|
|||||||
self.name = name
|
self.name = name
|
||||||
|
|
||||||
# Initialize property
|
# Initialize property
|
||||||
self._age = 0 # the leading underscore indicates the "age" property is
|
self._age = 0 # the leading underscore indicates the "age" property is
|
||||||
# intended to be used internally
|
# intended to be used internally
|
||||||
# do not rely on this to be enforced: it's a hint to other devs
|
# do not rely on this to be enforced: it's a hint to other devs
|
||||||
|
|
||||||
@ -754,7 +753,7 @@ class Human:
|
|||||||
|
|
||||||
# Another instance method
|
# Another instance method
|
||||||
def sing(self):
|
def sing(self):
|
||||||
return 'yo... yo... microphone check... one two... one two...'
|
return "yo... yo... microphone check... one two... one two..."
|
||||||
|
|
||||||
# A class method is shared among all instances
|
# A class method is shared among all instances
|
||||||
# They are called with the calling class as the first argument
|
# They are called with the calling class as the first argument
|
||||||
@ -788,7 +787,7 @@ class Human:
|
|||||||
# When a Python interpreter reads a source file it executes all its code.
|
# When a Python interpreter reads a source file it executes all its code.
|
||||||
# This __name__ check makes sure this code block is only executed when this
|
# This __name__ check makes sure this code block is only executed when this
|
||||||
# module is the main program.
|
# module is the main program.
|
||||||
if __name__ == '__main__':
|
if __name__ == "__main__":
|
||||||
# Instantiate a class
|
# Instantiate a class
|
||||||
i = Human(name="Ian")
|
i = Human(name="Ian")
|
||||||
i.say("hi") # "Ian: hi"
|
i.say("hi") # "Ian: hi"
|
||||||
@ -849,7 +848,7 @@ class Superhero(Human):
|
|||||||
# pass
|
# pass
|
||||||
|
|
||||||
# Child classes can override their parents' attributes
|
# Child classes can override their parents' attributes
|
||||||
species = 'Superhuman'
|
species = "Superhuman"
|
||||||
|
|
||||||
# Children automatically inherit their parent class's constructor including
|
# Children automatically inherit their parent class's constructor including
|
||||||
# its arguments, but can also define additional arguments or definitions
|
# its arguments, but can also define additional arguments or definitions
|
||||||
@ -872,7 +871,7 @@ class Superhero(Human):
|
|||||||
|
|
||||||
# override the sing method
|
# override the sing method
|
||||||
def sing(self):
|
def sing(self):
|
||||||
return 'Dun, dun, DUN!'
|
return "Dun, dun, DUN!"
|
||||||
|
|
||||||
# add an additional instance method
|
# add an additional instance method
|
||||||
def boast(self):
|
def boast(self):
|
||||||
@ -880,14 +879,14 @@ class Superhero(Human):
|
|||||||
print("I wield the power of {pow}!".format(pow=power))
|
print("I wield the power of {pow}!".format(pow=power))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == "__main__":
|
||||||
sup = Superhero(name="Tick")
|
sup = Superhero(name="Tick")
|
||||||
|
|
||||||
# Instance type checks
|
# Instance type checks
|
||||||
if isinstance(sup, Human):
|
if isinstance(sup, Human):
|
||||||
print('I am human')
|
print("I am human")
|
||||||
if type(sup) is Superhero:
|
if type(sup) is Superhero:
|
||||||
print('I am a superhero')
|
print("I am a superhero")
|
||||||
|
|
||||||
# Get the "Method Resolution Order" used by both getattr() and super()
|
# Get the "Method Resolution Order" used by both getattr() and super()
|
||||||
# (the order in which classes are searched for an attribute or method)
|
# (the order in which classes are searched for an attribute or method)
|
||||||
@ -902,7 +901,7 @@ if __name__ == '__main__':
|
|||||||
print(sup.sing()) # => Dun, dun, DUN!
|
print(sup.sing()) # => Dun, dun, DUN!
|
||||||
|
|
||||||
# Calls method from Human
|
# Calls method from Human
|
||||||
sup.say('Spoon') # => Tick: Spoon
|
sup.say("Spoon") # => Tick: Spoon
|
||||||
|
|
||||||
# Call method that exists only in Superhero
|
# Call method that exists only in Superhero
|
||||||
sup.boast() # => I wield the power of super strength!
|
sup.boast() # => I wield the power of super strength!
|
||||||
@ -913,33 +912,35 @@ if __name__ == '__main__':
|
|||||||
print(sup.age) # => 31
|
print(sup.age) # => 31
|
||||||
|
|
||||||
# Attribute that only exists within Superhero
|
# Attribute that only exists within Superhero
|
||||||
print('Am I Oscar eligible? ' + str(sup.movie))
|
print("Am I Oscar eligible? " + str(sup.movie))
|
||||||
|
|
||||||
####################################################
|
####################################################
|
||||||
## 6.2 Multiple Inheritance
|
## 6.2 Multiple Inheritance
|
||||||
####################################################
|
####################################################
|
||||||
|
|
||||||
|
|
||||||
# Another class definition
|
# Another class definition
|
||||||
# bat.py
|
# bat.py
|
||||||
class Bat:
|
class Bat:
|
||||||
|
|
||||||
species = 'Baty'
|
species = "Baty"
|
||||||
|
|
||||||
def __init__(self, can_fly=True):
|
def __init__(self, can_fly=True):
|
||||||
self.fly = can_fly
|
self.fly = can_fly
|
||||||
|
|
||||||
# This class also has a say method
|
# This class also has a say method
|
||||||
def say(self, msg):
|
def say(self, msg):
|
||||||
msg = '... ... ...'
|
msg = "... ... ..."
|
||||||
return msg
|
return msg
|
||||||
|
|
||||||
# And its own method as well
|
# And its own method as well
|
||||||
def sonar(self):
|
def sonar(self):
|
||||||
return '))) ... ((('
|
return "))) ... ((("
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
|
if __name__ == "__main__":
|
||||||
b = Bat()
|
b = Bat()
|
||||||
print(b.say('hello'))
|
print(b.say("hello"))
|
||||||
print(b.fly)
|
print(b.fly)
|
||||||
|
|
||||||
|
|
||||||
@ -959,44 +960,43 @@ class Batman(Superhero, Bat):
|
|||||||
# So instead we explicitly call __init__ for all ancestors.
|
# So instead we explicitly call __init__ for all ancestors.
|
||||||
# The use of *args and **kwargs allows for a clean way to pass
|
# The use of *args and **kwargs allows for a clean way to pass
|
||||||
# arguments, with each parent "peeling a layer of the onion".
|
# arguments, with each parent "peeling a layer of the onion".
|
||||||
Superhero.__init__(self, 'anonymous', movie=True,
|
Superhero.__init__(self, "anonymous", movie=True,
|
||||||
superpowers=['Wealthy'], *args, **kwargs)
|
superpowers=["Wealthy"], *args, **kwargs)
|
||||||
Bat.__init__(self, *args, can_fly=False, **kwargs)
|
Bat.__init__(self, *args, can_fly=False, **kwargs)
|
||||||
# override the value for the name attribute
|
# override the value for the name attribute
|
||||||
self.name = 'Sad Affleck'
|
self.name = "Sad Affleck"
|
||||||
|
|
||||||
def sing(self):
|
def sing(self):
|
||||||
return 'nan nan nan nan nan batman!'
|
return "nan nan nan nan nan batman!"
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == "__main__":
|
||||||
sup = Batman()
|
sup = Batman()
|
||||||
|
|
||||||
# The Method Resolution Order
|
# The Method Resolution Order
|
||||||
print(Batman.__mro__) # => (<class '__main__.Batman'>,
|
print(Batman.__mro__) # => (<class '__main__.Batman'>,
|
||||||
# => <class 'superhero.Superhero'>,
|
# => <class 'superhero.Superhero'>,
|
||||||
# => <class 'human.Human'>,
|
# => <class 'human.Human'>,
|
||||||
# => <class 'bat.Bat'>, <class 'object'>)
|
# => <class 'bat.Bat'>, <class 'object'>)
|
||||||
|
|
||||||
# Calls parent method but uses its own class attribute
|
# Calls parent method but uses its own class attribute
|
||||||
print(sup.get_species()) # => Superhuman
|
print(sup.get_species()) # => Superhuman
|
||||||
|
|
||||||
# Calls overridden method
|
# Calls overridden method
|
||||||
print(sup.sing()) # => nan nan nan nan nan batman!
|
print(sup.sing()) # => nan nan nan nan nan batman!
|
||||||
|
|
||||||
# Calls method from Human, because inheritance order matters
|
# Calls method from Human, because inheritance order matters
|
||||||
sup.say('I agree') # => Sad Affleck: I agree
|
sup.say("I agree") # => Sad Affleck: I agree
|
||||||
|
|
||||||
# Call method that exists only in 2nd ancestor
|
# Call method that exists only in 2nd ancestor
|
||||||
print(sup.sonar()) # => ))) ... (((
|
print(sup.sonar()) # => ))) ... (((
|
||||||
|
|
||||||
# Inherited class attribute
|
# Inherited class attribute
|
||||||
sup.age = 100
|
sup.age = 100
|
||||||
print(sup.age) # => 100
|
print(sup.age) # => 100
|
||||||
|
|
||||||
# Inherited attribute from 2nd ancestor whose default value was overridden.
|
# Inherited attribute from 2nd ancestor whose default value was overridden.
|
||||||
print('Can I fly? ' + str(sup.fly)) # => Can I fly? False
|
print("Can I fly? " + str(sup.fly)) # => Can I fly? False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
####################################################
|
####################################################
|
||||||
@ -1052,15 +1052,15 @@ def my_function(x,y): # def my_function(x,y):
|
|||||||
# When function definitions are long, it can be hard to parse the non-decorated
|
# When function definitions are long, it can be hard to parse the non-decorated
|
||||||
# assignment at the end of the definition.
|
# assignment at the end of the definition.
|
||||||
|
|
||||||
my_function(1,2) # => "Entering function my_function"
|
my_function(1,2) # => "Entering function my_function"
|
||||||
# => "3"
|
# => "3"
|
||||||
# => "Exiting function my_function"
|
# => "Exiting function my_function"
|
||||||
|
|
||||||
# But there's a problem.
|
# But there's a problem.
|
||||||
# What happens if we try to get some information about my_function?
|
# What happens if we try to get some information about my_function?
|
||||||
|
|
||||||
print(my_function.__name__) # => 'wrapper'
|
print(my_function.__name__) # => 'wrapper'
|
||||||
print(my_function.__code__.co_argcount) # => 0. The argcount is 0 because both arguments in wrapper()'s signature are optional.
|
print(my_function.__code__.co_argcount) # => 0. The argcount is 0 because both arguments in wrapper()'s signature are optional.
|
||||||
|
|
||||||
# Because our decorator is equivalent to my_function = log_function(my_function)
|
# Because our decorator is equivalent to my_function = log_function(my_function)
|
||||||
# we've replaced information about my_function with information from wrapper
|
# we've replaced information about my_function with information from wrapper
|
||||||
@ -1070,8 +1070,8 @@ print(my_function.__code__.co_argcount) # => 0. The argcount is 0 because both a
|
|||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
|
||||||
def log_function(func):
|
def log_function(func):
|
||||||
@wraps(func) # this ensures docstring, function name, arguments list, etc. are all copied
|
@wraps(func) # this ensures docstring, function name, arguments list, etc. are all copied
|
||||||
# to the wrapped function - instead of being replaced with wrapper's info
|
# to the wrapped function - instead of being replaced with wrapper's info
|
||||||
def wrapper(*args, **kwargs):
|
def wrapper(*args, **kwargs):
|
||||||
print("Entering function", func.__name__)
|
print("Entering function", func.__name__)
|
||||||
result = func(*args, **kwargs)
|
result = func(*args, **kwargs)
|
||||||
@ -1079,31 +1079,28 @@ def log_function(func):
|
|||||||
return result
|
return result
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
@log_function
|
@log_function
|
||||||
def my_function(x,y):
|
def my_function(x,y):
|
||||||
return x+y
|
return x+y
|
||||||
|
|
||||||
my_function(1,2) # => "Entering function my_function"
|
|
||||||
# => "3"
|
|
||||||
# => "Exiting function my_function"
|
|
||||||
|
|
||||||
print(my_function.__name__) # => 'my_function'
|
my_function(1,2) # => "Entering function my_function"
|
||||||
print(my_function.__code__.co_argcount) # => 2
|
# => "3"
|
||||||
|
# => "Exiting function my_function"
|
||||||
|
|
||||||
|
print(my_function.__name__) # => 'my_function'
|
||||||
|
print(my_function.__code__.co_argcount) # => 2
|
||||||
```
|
```
|
||||||
|
|
||||||
### Free Online
|
### Free Online
|
||||||
|
|
||||||
* [Automate the Boring Stuff with Python](https://automatetheboringstuff.com)
|
* [Automate the Boring Stuff with Python](https://automatetheboringstuff.com)
|
||||||
* [The Official Docs](https://docs.python.org/3/)
|
* [The Official Docs](https://docs.python.org/3/)
|
||||||
* [Hitchhiker's Guide to Python](https://docs.python-guide.org/en/latest/)
|
* [Hitchhiker's Guide to Python](https://docs.python-guide.org/)
|
||||||
* [Python Course](https://www.python-course.eu)
|
* [Python Course](https://www.python-course.eu)
|
||||||
* [Free Interactive Python Course](http://www.Kikodo.io)
|
|
||||||
* [First Steps With Python](https://realpython.com/learn/python-first-steps/)
|
* [First Steps With Python](https://realpython.com/learn/python-first-steps/)
|
||||||
* [A curated list of awesome Python frameworks, libraries and software](https://github.com/vinta/awesome-python)
|
* [A curated list of awesome Python frameworks, libraries and software](https://github.com/vinta/awesome-python)
|
||||||
* [30 Python Language Features and Tricks You May Not Know About](https://sahandsaba.com/thirty-python-language-features-and-tricks-you-may-not-know.html)
|
* [Official Style Guide for Python](https://peps.python.org/pep-0008/)
|
||||||
* [Official Style Guide for Python](https://www.python.org/dev/peps/pep-0008/)
|
|
||||||
* [Python 3 Computer Science Circles](https://cscircles.cemc.uwaterloo.ca/)
|
* [Python 3 Computer Science Circles](https://cscircles.cemc.uwaterloo.ca/)
|
||||||
* [Dive Into Python 3](https://www.diveintopython3.net/index.html)
|
* [Dive Into Python 3](https://www.diveintopython3.net/)
|
||||||
* [A Crash Course in Python for Scientists](https://nbviewer.jupyter.org/gist/anonymous/5924718)
|
|
||||||
* [Python Tutorial for Intermediates](https://pythonbasics.org/)
|
* [Python Tutorial for Intermediates](https://pythonbasics.org/)
|
||||||
* [Build a Desktop App with Python](https://pythonpyqt.com/)
|
* [Build a Desktop App with Python](https://pythonpyqt.com/)
|
||||||
|
@ -11,11 +11,11 @@ filename: learnpython-ru.py
|
|||||||
---
|
---
|
||||||
|
|
||||||
Язык Python был создан Гвидо ван Россумом в начале 90-х. Сейчас это один из
|
Язык Python был создан Гвидо ван Россумом в начале 90-х. Сейчас это один из
|
||||||
самых популярных языков. Я влюбился в Python за понятный и доходчивый синтаксис — это
|
самых популярных языков. Я влюбился в Python за понятный и доходчивый синтаксис — это
|
||||||
почти что исполняемый псевдокод.
|
почти что исполняемый псевдокод.
|
||||||
|
|
||||||
Замечание: Эта статья относится только к Python 3.
|
Замечание: Эта статья относится только к Python 3.
|
||||||
Если вы хотите изучить Python 2.7, обратитесь к [другой статье](https://learnxinyminutes.com/docs/ru-ru/pythonlegacy-ru/).
|
Если вы хотите изучить Python 2.7, обратитесь к [другой статье](/docs/ru-ru/pythonlegacy-ru/).
|
||||||
|
|
||||||
```python
|
```python
|
||||||
# Однострочные комментарии начинаются с символа решётки.
|
# Однострочные комментарии начинаются с символа решётки.
|
||||||
@ -40,12 +40,12 @@ filename: learnpython-ru.py
|
|||||||
|
|
||||||
# Результат целочисленного деления округляется в меньшую сторону
|
# Результат целочисленного деления округляется в меньшую сторону
|
||||||
# как для положительных, так и для отрицательных чисел.
|
# как для положительных, так и для отрицательных чисел.
|
||||||
5 // 3 # => 1
|
5 // 3 # => 1
|
||||||
-5 // 3 # => -2
|
-5 // 3 # => -2
|
||||||
5.0 // 3.0 # => 1.0 # работает и для чисел с плавающей запятой
|
5.0 // 3.0 # => 1.0 # работает и для чисел с плавающей запятой
|
||||||
-5.0 // 3.0 # => -2.0
|
-5.0 // 3.0 # => -2.0
|
||||||
|
|
||||||
# # Результат деления возвращает число с плавающей запятой
|
# Результат деления возвращает число с плавающей запятой
|
||||||
10.0 / 3 # => 3.3333333333333335
|
10.0 / 3 # => 3.3333333333333335
|
||||||
|
|
||||||
# Остаток от деления
|
# Остаток от деления
|
||||||
@ -125,7 +125,7 @@ b == a # => True, Объекты a и b равны
|
|||||||
"Это строка."
|
"Это строка."
|
||||||
'Это тоже строка.'
|
'Это тоже строка.'
|
||||||
|
|
||||||
# И строки тоже могут складываться! Хотя лучше не злоупотребляйте этим.
|
# И строки тоже могут складываться!
|
||||||
"Привет " + "мир!" # => "Привет мир!"
|
"Привет " + "мир!" # => "Привет мир!"
|
||||||
|
|
||||||
# Строки (но не переменные) могут быть объединены без использования '+'
|
# Строки (но не переменные) могут быть объединены без использования '+'
|
||||||
@ -139,9 +139,9 @@ len("Это строка") # => 10
|
|||||||
|
|
||||||
# Вы также можете форматировать, используя f-строки (в Python 3.6+)
|
# Вы также можете форматировать, используя f-строки (в Python 3.6+)
|
||||||
name = "Рейко"
|
name = "Рейко"
|
||||||
f"Она сказала, что ее зовут {name}." # => "Она сказала, что ее зовут Рейко"
|
f"Она сказала, что ее зовут {name}." # => "Она сказала, что ее зовут Рейко"
|
||||||
# Вы можете поместить любой оператор Python в фигурные скобки, и он будет выведен в строке.
|
# Вы можете поместить любой оператор Python в фигурные скобки, и он будет выведен в строке.
|
||||||
f"{name} состоит из {len(name)} символов." # => "Рэйко состоит из 5 символов."
|
f"{name} состоит из {len(name)} символов." # => "Рэйко состоит из 5 символов."
|
||||||
|
|
||||||
|
|
||||||
# None является объектом
|
# None является объектом
|
||||||
@ -168,8 +168,8 @@ bool(()) # => False
|
|||||||
# В Python есть функция Print
|
# В Python есть функция Print
|
||||||
print("Я Python. Приятно познакомиться!") # => Я Python. Приятно познакомиться!
|
print("Я Python. Приятно познакомиться!") # => Я Python. Приятно познакомиться!
|
||||||
|
|
||||||
# По умолчанию функция, print() также выводит новую строку в конце.
|
# По умолчанию, функция print() также выводит новую строку в конце.
|
||||||
# Используйте необязательный аргумент end, чтобы изменить последнюю строку.
|
# Используйте необязательный аргумент end, чтобы изменить конец последней строки.
|
||||||
print("Привет мир", end="!") # => Привет мир!
|
print("Привет мир", end="!") # => Привет мир!
|
||||||
|
|
||||||
# Простой способ получить входные данные из консоли
|
# Простой способ получить входные данные из консоли
|
||||||
@ -245,7 +245,7 @@ li.index(4) # Выбрасывает ошибку ValueError поскольку
|
|||||||
li + other_li # => [1, 2, 3, 4, 5, 6]
|
li + other_li # => [1, 2, 3, 4, 5, 6]
|
||||||
|
|
||||||
# Объединять списки можно методом extend()
|
# Объединять списки можно методом extend()
|
||||||
li.extend(other_li) # Теперь li содержит [1, 2, 3, 4, 5, 6]
|
li.extend(other_li) # Теперь li содержит [1, 2, 3, 4, 5, 6]
|
||||||
|
|
||||||
# Проверить элемент на наличие в списке можно оператором in
|
# Проверить элемент на наличие в списке можно оператором in
|
||||||
1 in li # => True
|
1 in li # => True
|
||||||
@ -273,7 +273,7 @@ tup[:2] # => (1, 2)
|
|||||||
# Вы можете распаковывать кортежи (или списки) в переменные
|
# Вы можете распаковывать кортежи (или списки) в переменные
|
||||||
a, b, c = (1, 2, 3) # a == 1, b == 2 и c == 3
|
a, b, c = (1, 2, 3) # a == 1, b == 2 и c == 3
|
||||||
# Вы также можете сделать расширенную распаковку
|
# Вы также можете сделать расширенную распаковку
|
||||||
a, *b, c = (1, 2, 3, 4) # a теперь 1, b теперь [2, 3] и c теперь 4
|
a, *b, c = (1, 2, 3, 4) # a теперь 1, b теперь [2, 3] и c теперь 4
|
||||||
# Кортежи создаются по умолчанию, если опущены скобки
|
# Кортежи создаются по умолчанию, если опущены скобки
|
||||||
d, e, f = 4, 5, 6 # кортеж 4, 5, 6 распаковывается в переменные d, e и f
|
d, e, f = 4, 5, 6 # кортеж 4, 5, 6 распаковывается в переменные d, e и f
|
||||||
# соответственно, d = 4, e = 5 и f = 6
|
# соответственно, d = 4, e = 5 и f = 6
|
||||||
@ -496,19 +496,19 @@ with open("myfile.txt") as f:
|
|||||||
# Запись в файл
|
# Запись в файл
|
||||||
contents = {"aa": 12, "bb": 21}
|
contents = {"aa": 12, "bb": 21}
|
||||||
with open("myfile1.txt", "w+") as file:
|
with open("myfile1.txt", "w+") as file:
|
||||||
file.write(str(contents)) # Записывает строку в файл
|
file.write(str(contents)) # Записывает строку в файл
|
||||||
|
|
||||||
with open("myfile2.txt", "w+") as file:
|
with open("myfile2.txt", "w+") as file:
|
||||||
file.write(json.dumps(contents)) # Записывает объект в файл
|
file.write(json.dumps(contents)) # Записывает объект в файл
|
||||||
|
|
||||||
# Чтение из файла
|
# Чтение из файла
|
||||||
with open('myfile1.txt', "r+") as file:
|
with open("myfile1.txt", "r+") as file:
|
||||||
contents = file.read() # Читает строку из файла
|
contents = file.read() # Читает строку из файла
|
||||||
print(contents) # => '{"aa": 12, "bb": 21}'
|
print(contents) # => '{"aa": 12, "bb": 21}'
|
||||||
|
|
||||||
with open('myfile2.txt', "r") as file:
|
with open("myfile2.txt", "r") as file:
|
||||||
contents = json.load(file) # Читает объект json из файла
|
contents = json.load(file) # Читает объект json из файла
|
||||||
print(contents) # => {"aa": 12, "bb": 21}
|
print(contents) # => {"aa": 12, "bb": 21}
|
||||||
|
|
||||||
|
|
||||||
# Python предоставляет фундаментальную абстракцию,
|
# Python предоставляет фундаментальную абстракцию,
|
||||||
@ -969,7 +969,7 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
# Унаследованный атрибут от второго родителя,
|
# Унаследованный атрибут от второго родителя,
|
||||||
# значение по умолчанию которого было переопределено.
|
# значение по умолчанию которого было переопределено.
|
||||||
print('Могу ли я летать? ' + str(sup.fly)) # => Могу ли я летать? False
|
print('Могу ли я летать? ' + str(sup.fly)) # => Могу ли я летать? False
|
||||||
|
|
||||||
|
|
||||||
####################################################
|
####################################################
|
||||||
@ -1034,16 +1034,13 @@ print(say(say_please=True)) # Вы не купите мне пива? Пожа
|
|||||||
### Бесплатные онлайн-материалы
|
### Бесплатные онлайн-материалы
|
||||||
|
|
||||||
* [Automate the Boring Stuff with Python](https://automatetheboringstuff.com)
|
* [Automate the Boring Stuff with Python](https://automatetheboringstuff.com)
|
||||||
* [Ideas for Python Projects](http://pythonpracticeprojects.com)
|
|
||||||
* [Официальная документация](http://docs.python.org/3/)
|
* [Официальная документация](http://docs.python.org/3/)
|
||||||
* [Hitchhiker's Guide to Python](http://docs.python-guide.org/en/latest/)
|
* [Hitchhiker's Guide to Python](http://docs.python-guide.org/)
|
||||||
* [Python Course](http://www.python-course.eu/index.php)
|
* [Python Course](http://www.python-course.eu/index.php)
|
||||||
* [First Steps With Python](https://realpython.com/learn/python-first-steps/)
|
* [First Steps With Python](https://realpython.com/learn/python-first-steps/)
|
||||||
* [A curated list of awesome Python frameworks, libraries and software](https://github.com/vinta/awesome-python)
|
* [A curated list of awesome Python frameworks, libraries and software](https://github.com/vinta/awesome-python)
|
||||||
* [30 Python Language Features and Tricks You May Not Know About](http://sahandsaba.com/thirty-python-language-features-and-tricks-you-may-not-know.html)
|
* [Official Style Guide for Python](https://peps.python.org/pep-0008/)
|
||||||
* [Official Style Guide for Python](https://www.python.org/dev/peps/pep-0008/)
|
|
||||||
* [Python 3 Computer Science Circles](http://cscircles.cemc.uwaterloo.ca/)
|
* [Python 3 Computer Science Circles](http://cscircles.cemc.uwaterloo.ca/)
|
||||||
* [Dive Into Python 3](http://www.diveintopython3.net/index.html)
|
* [Dive Into Python 3](http://www.diveintopython3.net/index.html)
|
||||||
* [A Crash Course in Python for Scientists](http://nbviewer.jupyter.org/gist/anonymous/5924718)
|
|
||||||
* [Python Tutorial for Intermediates](https://pythonbasics.org/)
|
* [Python Tutorial for Intermediates](https://pythonbasics.org/)
|
||||||
* [Build a Desktop App with Python](https://pythonpyqt.com/)
|
* [Build a Desktop App with Python](https://pythonpyqt.com/)
|
||||||
|
@ -622,13 +622,11 @@ print(soyle(lutfen_soyle=True)) # Ban soda alır mısın? Lutfen! Artık dayana
|
|||||||
* [Dive Into Python](http://www.diveintopython.net/)
|
* [Dive Into Python](http://www.diveintopython.net/)
|
||||||
* [Ideas for Python Projects](http://pythonpracticeprojects.com)
|
* [Ideas for Python Projects](http://pythonpracticeprojects.com)
|
||||||
* [The Official Docs](http://docs.python.org/3/)
|
* [The Official Docs](http://docs.python.org/3/)
|
||||||
* [Hitchhiker's Guide to Python](http://docs.python-guide.org/en/latest/)
|
* [Hitchhiker's Guide to Python](http://docs.python-guide.org/)
|
||||||
* [A Crash Course in Python for Scientists](http://nbviewer.ipython.org/5920182)
|
|
||||||
* [Python Course](http://www.python-course.eu/index.php)
|
* [Python Course](http://www.python-course.eu/index.php)
|
||||||
* [First Steps With Python](https://realpython.com/learn/python-first-steps/)
|
* [First Steps With Python](https://realpython.com/learn/python-first-steps/)
|
||||||
* [A curated list of awesome Python frameworks, libraries and software](https://github.com/vinta/awesome-python)
|
* [A curated list of awesome Python frameworks, libraries and software](https://github.com/vinta/awesome-python)
|
||||||
* [30 Python Language Features and Tricks You May Not Know About](http://sahandsaba.com/thirty-python-language-features-and-tricks-you-may-not-know.html)
|
* [Official Style Guide for Python](https://peps.python.org/pep-0008/)
|
||||||
* [Official Style Guide for Python](https://www.python.org/dev/peps/pep-0008/)
|
|
||||||
* [Python 3 Computer Science Circles](http://cscircles.cemc.uwaterloo.ca/)
|
* [Python 3 Computer Science Circles](http://cscircles.cemc.uwaterloo.ca/)
|
||||||
|
|
||||||
### Kitaplar
|
### Kitaplar
|
||||||
|
@ -900,12 +900,10 @@ print(say(say_please=True)) # Mua bia cho tui nhé? Làm ơn! Tui rất nghèo
|
|||||||
* [Automate the Boring Stuff with Python](https://automatetheboringstuff.com)
|
* [Automate the Boring Stuff with Python](https://automatetheboringstuff.com)
|
||||||
* [Ideas for Python Projects](http://pythonpracticeprojects.com)
|
* [Ideas for Python Projects](http://pythonpracticeprojects.com)
|
||||||
* [The Official Docs](http://docs.python.org/3/)
|
* [The Official Docs](http://docs.python.org/3/)
|
||||||
* [Hitchhiker's Guide to Python](http://docs.python-guide.org/en/latest/)
|
* [Hitchhiker's Guide to Python](http://docs.python-guide.org/)
|
||||||
* [Python Course](http://www.python-course.eu/index.php)
|
* [Python Course](http://www.python-course.eu/index.php)
|
||||||
* [First Steps With Python](https://realpython.com/learn/python-first-steps/)
|
* [First Steps With Python](https://realpython.com/learn/python-first-steps/)
|
||||||
* [A curated list of awesome Python frameworks, libraries and software](https://github.com/vinta/awesome-python)
|
* [A curated list of awesome Python frameworks, libraries and software](https://github.com/vinta/awesome-python)
|
||||||
* [30 Python Language Features and Tricks You May Not Know About](http://sahandsaba.com/thirty-python-language-features-and-tricks-you-may-not-know.html)
|
* [Official Style Guide for Python](https://peps.python.org/pep-0008/)
|
||||||
* [Official Style Guide for Python](https://www.python.org/dev/peps/pep-0008/)
|
|
||||||
* [Python 3 Computer Science Circles](http://cscircles.cemc.uwaterloo.ca/)
|
* [Python 3 Computer Science Circles](http://cscircles.cemc.uwaterloo.ca/)
|
||||||
* [Dive Into Python 3](http://www.diveintopython3.net/index.html)
|
* [Dive Into Python 3](http://www.diveintopython3.net/index.html)
|
||||||
* [A Crash Course in Python for Scientists](http://nbviewer.jupyter.org/gist/anonymous/5924718)
|
|
||||||
|
@ -9,7 +9,6 @@ translators:
|
|||||||
- ["Maple", "https://github.com/mapleincode"]
|
- ["Maple", "https://github.com/mapleincode"]
|
||||||
filename: learnpython-cn.py
|
filename: learnpython-cn.py
|
||||||
lang: zh-cn
|
lang: zh-cn
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
Python 是由吉多·范罗苏姆(Guido Van Rossum)在 90 年代早期设计。
|
Python 是由吉多·范罗苏姆(Guido Van Rossum)在 90 年代早期设计。
|
||||||
@ -1015,8 +1014,6 @@ print(say()) # Can you buy me a beer?
|
|||||||
print(say(say_please=True)) # Can you buy me a beer? Please! I am poor :(
|
print(say(say_please=True)) # Can you buy me a beer? Please! I am poor :(
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## 想继续学吗?
|
## 想继续学吗?
|
||||||
|
|
||||||
### 在线免费材料(英文)
|
### 在线免费材料(英文)
|
||||||
@ -1024,16 +1021,13 @@ print(say(say_please=True)) # Can you buy me a beer? Please! I am poor :(
|
|||||||
* [Automate the Boring Stuff with Python](https://automatetheboringstuff.com/)
|
* [Automate the Boring Stuff with Python](https://automatetheboringstuff.com/)
|
||||||
* [Ideas for Python Projects](http://pythonpracticeprojects.com/)
|
* [Ideas for Python Projects](http://pythonpracticeprojects.com/)
|
||||||
* [The Official Docs](https://docs.python.org/3/)
|
* [The Official Docs](https://docs.python.org/3/)
|
||||||
* [Hitchhiker’s Guide to Python](https://docs.python-guide.org/en/latest/)
|
* [Hitchhiker’s Guide to Python](https://docs.python-guide.org/)
|
||||||
* [Python Course](https://www.python-course.eu/)
|
* [Python Course](https://www.python-course.eu/)
|
||||||
* [Free Interactive Python Course](http://www.kikodo.io/)
|
|
||||||
* [First Steps With Python](https://realpython.com/learn/python-first-steps/)
|
* [First Steps With Python](https://realpython.com/learn/python-first-steps/)
|
||||||
* [A curated list of awesome Python frameworks, libraries and software](https://github.com/vinta/awesome-python)
|
* [A curated list of awesome Python frameworks, libraries and software](https://github.com/vinta/awesome-python)
|
||||||
* [30 Python Language Features and Tricks You May Not Know About](https://sahandsaba.com/thirty-python-language-features-and-tricks-you-may-not-know.html)
|
* [Official Style Guide for Python](https://peps.python.org/pep-0008/)
|
||||||
* [Official Style Guide for Python](https://www.python.org/dev/peps/pep-0008/)
|
|
||||||
* [Python 3 Computer Science Circles](https://cscircles.cemc.uwaterloo.ca/)
|
* [Python 3 Computer Science Circles](https://cscircles.cemc.uwaterloo.ca/)
|
||||||
* [Dive Into Python 3](https://www.diveintopython3.net/index.html)
|
* [Dive Into Python 3](https://www.diveintopython3.net/)
|
||||||
* [A Crash Course in Python for Scientists](https://nbviewer.jupyter.org/gist/anonymous/5924718)
|
|
||||||
* [Python Tutorial for Intermediates](https://pythonbasics.org/)
|
* [Python Tutorial for Intermediates](https://pythonbasics.org/)
|
||||||
* [Build a Desktop App with Python](https://pythonpyqt.com/)
|
* [Build a Desktop App with Python](https://pythonpyqt.com/)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user