[python/*] proofread en and ru and all links

This commit is contained in:
Boris Verkhovskiy 2024-04-26 01:48:54 -07:00
parent cbb2eb4f00
commit 1924d58159
13 changed files with 131 additions and 161 deletions

View File

@ -1003,14 +1003,11 @@ print(say(say_please=True)) # Can you buy me a beer? Please! I am poor :(
### مجانا عبر الانترنت
* [أتمتتة المهمات المُملة عبر بايثون](https://automatetheboringstuff.com)
* [أفكار لمشروعات بلغة البايثون](http://pythonpracticeprojects.com)
* [التوثيقات الرسمية](http://docs.python.org/3/)
* [دليل المُسافر لبايثون](http://docs.python-guide.org/en/latest/)
* [دورة بايثون](http://www.python-course.eu/index.php)
* [أولى الخطوات مع بايثون](https://realpython.com/learn/python-first-steps/)
* [قائمة مُختارة من إطارات عمل بايثون الرائعة, المكتبات والبرمجيات](https://github.com/vinta/awesome-python)
* [ثلاثون خاصية وخدعة للغة البايثون ربما لم تعرف بها](http://sahandsaba.com/thirty-python-language-features-and-tricks-you-may-not-know.html)
* [الدليل الرسمي لنمط البايثون](https://www.python.org/dev/peps/pep-0008/)
* [الدليل الرسمي لنمط البايثون](https://peps.python.org/pep-0008/)
* [بايثون 3 دوائر علوم الحاسب](http://cscircles.cemc.uwaterloo.ca/)
* [غُص في بايثون 3](http://www.diveintopython3.net/index.html)
* [دورة سريعة في البايثون للعلماء](http://nbviewer.jupyter.org/gist/anonymous/5924718)

View File

@ -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/)
* [Ideas for Python Projects](http://pythonpracticeprojects.com)
* [The Official Docs](http://docs.python.org/3/)
* [Hitchhiker's Guide to Python](http://docs.python-guide.org/en/latest/)
* [A Crash Course in Python for Scientists](http://nbviewer.ipython.org/5920182)
* [Hitchhiker's Guide to Python](http://docs.python-guide.org/)
* [Python Course](http://www.python-course.eu/index.php)
* [First Steps With Python](https://realpython.com/learn/python-first-steps/)

View File

@ -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)
* [Ideas for Python Projects](http://pythonpracticeprojects.com)
* [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)
* [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)
* [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://www.python.org/dev/peps/pep-0008/)
* [Official Style Guide for Python](https://peps.python.org/pep-0008/)
* [Python 3 Computer Science Circles](http://cscircles.cemc.uwaterloo.ca/)
* [Dive Into Python 3](http://www.diveintopython3.net/index.html)
* [A Crash Course in Python for Scientists](http://nbviewer.jupyter.org/gist/anonymous/5924718)

View File

@ -562,9 +562,8 @@ print(decir(decir_por_favor=True)) # ¿Puedes comprarme una cerveza? ¡Por favo
* [Dive Into Python](http://www.diveintopython.net/)
* [Ideas for Python Projects](http://pythonpracticeprojects.com)
* [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/)
* [A Crash Course in Python for Scientists](http://nbviewer.ipython.org/5920182)
### Encuadernados

View File

@ -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/)
* [Ideas for Python Projects](http://pythonpracticeprojects.com)
* [The Official Docs](http://docs.python.org/3/)
* [Hitchhiker's Guide to Python](http://docs.python-guide.org/en/latest/)
* [A Crash Course in Python for Scientists](http://nbviewer.ipython.org/5920182)
* [Hitchhiker's Guide to Python](http://docs.python-guide.org/)
* [Python Course](http://www.python-course.eu/index.php)
* [First Steps With Python](https://realpython.com/learn/python-first-steps/)

View File

@ -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)
* [Ideas for Python Projects](http://pythonpracticeprojects.com)
* [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)
* [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)
* [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://www.python.org/dev/peps/pep-0008/)
* [Official Style Guide for Python](https://peps.python.org/pep-0008/)
* [Python 3 Computer Science Circles](http://cscircles.cemc.uwaterloo.ca/)
* [Dive Into Python 3](http://www.diveintopython3.net/index.html)
* [A Crash Course in Python for Scientists](http://nbviewer.jupyter.org/gist/anonymous/5924718)

View File

@ -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)
* [Ideas for Python Projects](http://pythonpracticeprojects.com)
* [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)
* [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)
* [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://www.python.org/dev/peps/pep-0008/)
* [Official Style Guide for Python](https://peps.python.org/pep-0008/)
* [Python 3 Computer Science Circles](http://cscircles.cemc.uwaterloo.ca/)
* [Dive Into Python 3](http://www.diveintopython3.net/index.html)
* [A Crash Course in Python for Scientists](http://nbviewer.jupyter.org/gist/anonymous/5924718)

View File

@ -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/)
* [Ideas for Python Projects](http://pythonpracticeprojects.com)
* [The Official Docs](http://docs.python.org/3/)
* [Hitchhiker's Guide to Python](http://docs.python-guide.org/en/latest/)
* [A Crash Course in Python for Scientists](http://nbviewer.ipython.org/5920182)
* [Hitchhiker's Guide to Python](http://docs.python-guide.org/)
* [Python Course](http://www.python-course.eu/index.php)
* [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)
* [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://www.python.org/dev/peps/pep-0008/)
* [Official Style Guide for Python](https://peps.python.org/pep-0008/)
### Dead Tree

View File

@ -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
# From Python 3.5 you can also use the additional unpacking options
{'a': 1, **{'b': 2}} # => {'a': 1, 'b': 2}
{'a': 1, **{'a': 2}} # => {'a': 2}
{"a": 1, **{"b": 2}} # => {'a': 1, 'b': 2}
{"a": 1, **{"a": 2}} # => {'a': 2}
# Sets store ... well sets
@ -504,12 +503,12 @@ with open("myfile2.txt", "w") as file:
file.write(json.dumps(contents)) # writes an object to 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
print(contents)
# 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
print(contents)
# print: {"aa": 12, "bb": 21}
@ -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]
# 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}
@ -754,7 +753,7 @@ class Human:
# Another instance method
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
# 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.
# This __name__ check makes sure this code block is only executed when this
# module is the main program.
if __name__ == '__main__':
if __name__ == "__main__":
# Instantiate a class
i = Human(name="Ian")
i.say("hi") # "Ian: hi"
@ -849,7 +848,7 @@ class Superhero(Human):
# pass
# Child classes can override their parents' attributes
species = 'Superhuman'
species = "Superhuman"
# Children automatically inherit their parent class's constructor including
# its arguments, but can also define additional arguments or definitions
@ -872,7 +871,7 @@ class Superhero(Human):
# override the sing method
def sing(self):
return 'Dun, dun, DUN!'
return "Dun, dun, DUN!"
# add an additional instance method
def boast(self):
@ -880,14 +879,14 @@ class Superhero(Human):
print("I wield the power of {pow}!".format(pow=power))
if __name__ == '__main__':
if __name__ == "__main__":
sup = Superhero(name="Tick")
# Instance type checks
if isinstance(sup, Human):
print('I am human')
print("I am human")
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()
# (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!
# Calls method from Human
sup.say('Spoon') # => Tick: Spoon
sup.say("Spoon") # => Tick: Spoon
# Call method that exists only in Superhero
sup.boast() # => I wield the power of super strength!
@ -913,33 +912,35 @@ if __name__ == '__main__':
print(sup.age) # => 31
# 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
####################################################
# Another class definition
# bat.py
class Bat:
species = 'Baty'
species = "Baty"
def __init__(self, can_fly=True):
self.fly = can_fly
# This class also has a say method
def say(self, msg):
msg = '... ... ...'
msg = "... ... ..."
return msg
# And its own method as well
def sonar(self):
return '))) ... ((('
return "))) ... ((("
if __name__ == '__main__':
if __name__ == "__main__":
b = Bat()
print(b.say('hello'))
print(b.say("hello"))
print(b.fly)
@ -959,17 +960,17 @@ class Batman(Superhero, Bat):
# So instead we explicitly call __init__ for all ancestors.
# The use of *args and **kwargs allows for a clean way to pass
# arguments, with each parent "peeling a layer of the onion".
Superhero.__init__(self, 'anonymous', movie=True,
superpowers=['Wealthy'], *args, **kwargs)
Superhero.__init__(self, "anonymous", movie=True,
superpowers=["Wealthy"], *args, **kwargs)
Bat.__init__(self, *args, can_fly=False, **kwargs)
# override the value for the name attribute
self.name = 'Sad Affleck'
self.name = "Sad Affleck"
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()
# The Method Resolution Order
@ -985,7 +986,7 @@ if __name__ == '__main__':
print(sup.sing()) # => nan nan nan nan nan batman!
# 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
print(sup.sonar()) # => ))) ... (((
@ -995,8 +996,7 @@ if __name__ == '__main__':
print(sup.age) # => 100
# 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
####################################################
@ -1095,15 +1095,12 @@ print(my_function.__code__.co_argcount) # => 2
* [Automate the Boring Stuff with Python](https://automatetheboringstuff.com)
* [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)
* [Free Interactive Python Course](http://www.Kikodo.io)
* [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)
* [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://www.python.org/dev/peps/pep-0008/)
* [Official Style Guide for Python](https://peps.python.org/pep-0008/)
* [Python 3 Computer Science Circles](https://cscircles.cemc.uwaterloo.ca/)
* [Dive Into Python 3](https://www.diveintopython3.net/index.html)
* [A Crash Course in Python for Scientists](https://nbviewer.jupyter.org/gist/anonymous/5924718)
* [Dive Into Python 3](https://www.diveintopython3.net/)
* [Python Tutorial for Intermediates](https://pythonbasics.org/)
* [Build a Desktop App with Python](https://pythonpyqt.com/)

View File

@ -15,7 +15,7 @@ filename: learnpython-ru.py
почти что исполняемый псевдокод.
Замечание: Эта статья относится только к Python 3.
Если вы хотите изучить Python 2.7, обратитесь к [другой статье](https://learnxinyminutes.com/docs/ru-ru/pythonlegacy-ru/).
Если вы хотите изучить Python 2.7, обратитесь к [другой статье](/docs/ru-ru/pythonlegacy-ru/).
```python
# Однострочные комментарии начинаются с символа решётки.
@ -45,7 +45,7 @@ filename: learnpython-ru.py
5.0 // 3.0 # => 1.0 # работает и для чисел с плавающей запятой
-5.0 // 3.0 # => -2.0
# # Результат деления возвращает число с плавающей запятой
# Результат деления возвращает число с плавающей запятой
10.0 / 3 # => 3.3333333333333335
# Остаток от деления
@ -125,7 +125,7 @@ b == a # => True, Объекты a и b равны
"Это строка."
'Это тоже строка.'
# И строки тоже могут складываться! Хотя лучше не злоупотребляйте этим.
# И строки тоже могут складываться!
"Привет " + "мир!" # => "Привет мир!"
# Строки (но не переменные) могут быть объединены без использования '+'
@ -168,8 +168,8 @@ bool(()) # => False
# В Python есть функция Print
print("Я Python. Приятно познакомиться!") # => Я Python. Приятно познакомиться!
# По умолчанию функция, print() также выводит новую строку в конце.
# Используйте необязательный аргумент end, чтобы изменить последнюю строку.
# По умолчанию, функция print() также выводит новую строку в конце.
# Используйте необязательный аргумент end, чтобы изменить конец последней строки.
print("Привет мир", end="!") # => Привет мир!
# Простой способ получить входные данные из консоли
@ -502,11 +502,11 @@ with open("myfile2.txt", "w+") as file:
file.write(json.dumps(contents)) # Записывает объект в файл
# Чтение из файла
with open('myfile1.txt', "r+") as file:
with open("myfile1.txt", "r+") as file:
contents = file.read() # Читает строку из файла
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 из файла
print(contents) # => {"aa": 12, "bb": 21}
@ -1034,16 +1034,13 @@ print(say(say_please=True)) # Вы не купите мне пива? Пожа
### Бесплатные онлайн-материалы
* [Automate the Boring Stuff with Python](https://automatetheboringstuff.com)
* [Ideas for Python Projects](http://pythonpracticeprojects.com)
* [Официальная документация](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)
* [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)
* [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://www.python.org/dev/peps/pep-0008/)
* [Official Style Guide for Python](https://peps.python.org/pep-0008/)
* [Python 3 Computer Science Circles](http://cscircles.cemc.uwaterloo.ca/)
* [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/)
* [Build a Desktop App with Python](https://pythonpyqt.com/)

View File

@ -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/)
* [Ideas for Python Projects](http://pythonpracticeprojects.com)
* [The Official Docs](http://docs.python.org/3/)
* [Hitchhiker's Guide to Python](http://docs.python-guide.org/en/latest/)
* [A Crash Course in Python for Scientists](http://nbviewer.ipython.org/5920182)
* [Hitchhiker's Guide to Python](http://docs.python-guide.org/)
* [Python Course](http://www.python-course.eu/index.php)
* [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)
* [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://www.python.org/dev/peps/pep-0008/)
* [Official Style Guide for Python](https://peps.python.org/pep-0008/)
* [Python 3 Computer Science Circles](http://cscircles.cemc.uwaterloo.ca/)
### Kitaplar

View File

@ -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)
* [Ideas for Python Projects](http://pythonpracticeprojects.com)
* [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)
* [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)
* [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://www.python.org/dev/peps/pep-0008/)
* [Official Style Guide for Python](https://peps.python.org/pep-0008/)
* [Python 3 Computer Science Circles](http://cscircles.cemc.uwaterloo.ca/)
* [Dive Into Python 3](http://www.diveintopython3.net/index.html)
* [A Crash Course in Python for Scientists](http://nbviewer.jupyter.org/gist/anonymous/5924718)

View File

@ -9,7 +9,6 @@ translators:
- ["Maple", "https://github.com/mapleincode"]
filename: learnpython-cn.py
lang: zh-cn
---
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 :(
```
## 想继续学吗?
### 在线免费材料(英文)
@ -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/)
* [Ideas for Python Projects](http://pythonpracticeprojects.com/)
* [The Official Docs](https://docs.python.org/3/)
* [Hitchhikers Guide to Python](https://docs.python-guide.org/en/latest/)
* [Hitchhikers Guide to Python](https://docs.python-guide.org/)
* [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/)
* [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://www.python.org/dev/peps/pep-0008/)
* [Official Style Guide for Python](https://peps.python.org/pep-0008/)
* [Python 3 Computer Science Circles](https://cscircles.cemc.uwaterloo.ca/)
* [Dive Into Python 3](https://www.diveintopython3.net/index.html)
* [A Crash Course in Python for Scientists](https://nbviewer.jupyter.org/gist/anonymous/5924718)
* [Dive Into Python 3](https://www.diveintopython3.net/)
* [Python Tutorial for Intermediates](https://pythonbasics.org/)
* [Build a Desktop App with Python](https://pythonpyqt.com/)