This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Hij: | |
| attr = 1 | |
| hij_var = Hij() | |
| hij_var.attr = 2 | |
| hij_var.__dict__ # => {'attr': 2} | |
| ############################################################################### | |
| class Abc: | |
| __slots__ = ["some_attr"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import string | |
| def toJadenCase(NonJadenStrings): | |
| return string.capwords(NonJadenStrings) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def change_case(string): | |
| """ | |
| На входе: "how can mirrors be real if our eyes aren't real" | |
| Должны получить: "How Can Mirrors Be Real If Our Eyes Aren't Real" | |
| Получим на самом деле: "How Can Mirrors Be Real If Our Eyes Aren'T Real" | |
| """ | |
| return string.title() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sqlite3 | |
| conn = sqlite3.connect('base.db') # Название файла БД | |
| c = conn.cursor() | |
| c.execute('''create table users | |
| (id int, nick text, login text)''') # Создали таблицу users с полями ID, NICK, LOGIN | |
| # Сохраняем изменения | |
| conn.commit() | |
| c.close() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sqlite3 | |
| conn = sqlite3.connect('base.db') | |
| c = conn.cursor() | |
| while True: | |
| a = input('\nДобавить запись: a \nУдалить: d INT\nВыход: b\n> ') | |
| if a == 'a': |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo apt-get install sqlite3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| nohup python3 file.py & |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| При описании синтаксиса команд мы, как правило, используем те же обозначения, | |
| что и в интерактивном руководстве: | |
| • текст, заключенный в квадратные скобки (“[” и “]”), является необязательным; | |
| • текст, после которого стоит многоточие (“...”), можно повторять; | |
| • фигурные скобки (“{” и “}”) указывают на то, что необходимо выбрать один из | |
| элементов, разделенных вертикальной чертой (“|”). | |
| Например, спецификации | |
| bork [—х] {on|off} имя_файла... | |
| соответствует любая из следующих команд: | |
| bork on /etc/passwd |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| http://s3.amazonaws.com/codecademy-blog/assets/ae09140c.png |
NewerOlder