Spellchecking
PyCharm checks the spelling of all your source code, including variable names, text in strings, comments, literals, and commit messages. For this purpose, PyCharm provides a dedicated Typo inspection which is enabled by default.
The Typo inspection detects and highlights words that are not included in any dictionary. You can either correct the spelling or save the word to the dictionary.
Disable the Typo inspection if you want to ignore all spelling mistakes. For more information, refer to Disable spellchecking.
Correct a misspelled word
- Place the caret at any word highlighted by the Typo inspection.
- Click or press Alt+Enter to show the available intention actions.
- Select one of the suggested fixes from the list.
In string literals and comments, only the spelling of this particular word at caret changes. For code elements, such as names of variables, functions, classes, and other symbols, the inspection also suggests changing all occurrences via the Rename refactoring.
Save a word to dictionary
If a detected typo is actually a valid word, you can add it to a user-defined dictionary that extends the built-in dictionaries.
- Place the caret at a word highlighted by the Typo inspection.
- Click or press Alt+Enter to show the available intention actions.
- Select the Save to dictionary action to add the word to the user’s dictionary and skip it in the future. If you have added the word by mistake, press Control+Z to remove it from the dictionary.
By default, PyCharm saves words to the global application-level dictionary. You can choose to save words to the project-level dictionary if the spelling is correct only for this particular project. For more information, refer to Select the default dictionary for saving words.
Press F2 and Shift+F2 to step through all problems in a file, including typos.
Find all spelling mistakes
The Typo inspection highlights typos in the current file. You can also run the inspection on your entire project or a set of files. For more information, refer to Run a single inspection.
- In the main menu, go to Code | Analyze Code | Run Inspection by Name… or press Control+Alt+Shift+I .
- In the Enter inspection name popup, find and select the Typo inspection.
- In the Run ‘Typo’ dialog, select the scope in which you want to run the inspection, and other options, such as a file mask filter. Then click OK .
PyCharm will run the Typo inspection on all files in the selected scope and show all found typos in a separate tab of the Problems tool window.
Configure the Typo inspection
By default, the Typo inspection checks all text, including code elements, string literals, and comments in all scopes.
- Press Control+Alt+S to open the IDE settings and then select Editor | Inspections .
- Expand the Proofreading node and click Typo in the central pane.
- In the right-hand pane, configure the Typo inspection: Severity Specify the severity level and the scope in which to apply this level. For example, if you want typos to stand out more, select Error or Warning to highlight typos similar to syntax errors or warnings in your code. Options Specify the type of content to check:
- Process code : check various code elements.
- Process literals : check text inside string literals.
- Process comments : check text inside comments.
Suppress the Typo inspection
Like with any other inspection, you can suppress the Typo inspection for specific files and code elements.

- Place the caret at a word highlighted by the Typo inspection.
- Click or press Alt+Enter to show the available intention actions.
- On one of the suggested fixes, press the right arrow key or click and select Suppress for class or another relevant suppress action.
Depending on the language and code element, this adds a special annotation or comment that tells the editor to suppress the relevant inspection in the corresponding scope. For example, in case of Python, suppressing the Typo inspection for a class adds the following annotation before the class declaration:
# noinspection SpellCheckingInspection
This suppresses all spelling checks within the class.
For more information, refer to Suppress inspections.
Disable spellchecking
- Press Control+Alt+S to open the IDE settings and then select Editor | Inspections .
- Clear the checkbox next to the Typo inspection.
Dictionaries
PyCharm includes bundled dictionaries for all configured languages. You cannot change them directly, but you can extend the spellchecker in other ways:
- Save words to a built-in global or project dictionary.
- Add plain-text files with the .dic extension that contain lists of words.
- You can add Hunspell dictionaries, each of which consists of two files: the DIC file that contains a list of words with the applicable modification rules and the AFF file that lists prefixes and suffixes regulated by a specific modification rule. For example, en_GB.dic and en_GB.aff .
Configure the spellchecker dictionaries
- Press Control+Alt+S to open the IDE settings and then select Editor | Natural Languages | Spelling .
- Configure the list of custom dictionaries:
- To add a new custom dictionary to the list, click or press Alt+Insert and specify the location of the required file.
- To edit the contents of a custom dictionary in PyCharm, select it and click or press Enter . The corresponding file will open in a new editor tab.
- To remove a custom dictionary from the list, select it and click or press Alt+Delete .
Select the default dictionary for saving words
By default, PyCharm saves words to the global application-level dictionary. You can choose to save words to the project-level dictionary if the spelling is correct only for this particular project.
- Press Control+Alt+S to open the IDE settings and then select Editor | Natural Languages | Spelling .
- Select either the built-in project-level or application-level dictionary or disable the option to prompt you every time you save a word.
Add accepted words manually
- Press Control+Alt+S to open the IDE settings and then select Editor | Natural Languages | Spelling .
- Add words to the Accepted words list. PyCharm adds manually accepted words to the project-level dictionary. You can’t add words that are already present in one of the dictionaries and mixed-case words, such as CamelCase and snake_case .
The Accepted words list also contains words that you saved to either the built-in global or project dictionary. Although it does not contain words added to the project-level dictionary by other users and words from other custom dictionaries, the Typo inspection will not highlight them.
Share dictionaries
PyCharm stores the built-in project-level dictionary with other project-related files. This means that anyone working with the project has access to the words stored in this dictionary.
To share your application-level dictionary, use the bundled Settings Sync plugin.
Понимание необходимости функционального тестирования — Python — Ответ 15163034
Видишь ли, все эти проверки в рантайме только замедляют код. Так что если это не внешнее API, то лучше их убрать.
Тесты же первую очередь проверяют код на правильность работы при правильных входных данных.
Ну скормил ты функции вместо строки число (хотя аннотация функции явно говорит, что принимает строку) — так сам виноват и IDE или pylint с лёгкостью обнаруживают такие ошибки.
Добавлено через 6 минут
1 2 3 4 5
def add_strs(str1: str, str2: str) -> str: return str1 + str2 print(add_strs(1, 2))
Expected type 'str', got 'int' instead Expected type 'str', got 'int' instead Typo: In word 'strs'
C0114: Missing module docstring (missing-module-docstring) C0116: Missing function or method docstring (missing-function-docstring)
Добавлено через 4 минуты
mypy крут!
:5: error: Argument 1 to "add_strs" has incompatible type "int"; expected "str" :5: error: Argument 2 to "add_strs" has incompatible type "int"; expected "str"
Добавлено через 31 секунду
А тупой pylint только и умеет ныть, что где-то не хватает документации.
| Меню пользователя Рыжий Лис |
| Читать блог |
typo
typo is a python package to simulate typographical errors in English language.
Release 0.1.7
- Ability to preserve first and/or last characters in error methods.
Usage
Currently, following types of typos can be simulated:
String typos:
Given the input Hello World! Happy new year 2021., different error types produce the following errors.
| Error method | Description | Sample output |
|---|---|---|
| char_swap(preservefirst=False, preservelast=False) | Swaps two random consecutive word characters in the string. | Hello World! Ahppy new year 2021. |
| missing_char(preservefirst=False, preservelast=False) | Skips a random word character in the string. | Hllo World! Happy new year 2021. |
| extra_char(preservefirst=False, preservelast=False) | Adds an extra, keyboard-neighbor, letter next to a random word character. | Hrello World! Happy new year 2021. |
| nearby_char(preservefirst=False, preservelast=False) | Replaces a random word character with keyboard-neighbor letter. | Hello World! Happy new ysar 2021. |
| similar_char() | Replaces a random word character with another visually similar character. | Hell0 world! Happy new year 2021. |
| skipped_space() | Skips a random space from the string. | Hello world! Happy new year2021. |
| random_space() | Adds a random space in the string. | Hell o world! Happy new year 2021. |
| repeated_char() | Repeats a random word character. | Hello worrld! Happy new year 2021. |
| unichar() | Replaces a random consecutive repeated letter with a single letter. | Hello world! Hapy new year 2021. |
Integer typos:
| Error method | Description | Input | Sample output |
|---|---|---|---|
| digit_swap(preservefirst=False, preservelast=False) | Swaps two random consecutive digits in the integer. | 1234567890 | 1324567890 |
| missing_digit(preservefirst=False, preservelast=False) | Skips a random digit in the integer. | -1234567890 | -123457890 |
| extra_digit(preservefirst=False, preservelast=False) | Adds an extra, keyboard-neighbor, digit next to a random digit in the integer. | 1234567890 | 12345678920 |
| nearby_digit(preservefirst=False, preservelast=False) | Replaces a random digit in the integer with a keyboard-neighbor digit. | 1234567890 | 1234567892 |
| similar_digit() | Replaces a random digit with another visually similar digit. | 1234567890 | 1234567896 |
| repeated_digit() | Repeats a random digit in the integer. | 1234567890 | 12345678900 |
| unidigit() | Replaces a random consecutive repeated digit with a single digit. | -112233445566 | -11233445566 |
Datetime typos:
| Error method | Description | Input | Sample output |
|---|---|---|---|
| date_month_swap() | Swaps the day and month of the date if the value of the day is less than or equal to 12. | 8 Mar 95 | 3 Aug 95 |
Добрый вечер, пытаюсь запустить парсер сайта, выдает ошибки, в чем проблема?

No_FaP, у меня ошибки не выдает. Возможно у тебя еще есть код кроме этого? Обычно такое бывает когда юзаешь 2 и 4 пробела в отступах одновременно.
Разберись с отступами или кадай весь код!
from bs4 import BeautifulSoup import requests def save(): with open('parse_info.txt', 'a') as file: file.write(f' -> Price: -> Link: \n') def parse(): URL = 'https://www.olx.kz/transport/legkovye-avtomobili/' HEADERS = < 'User-Agent': '&&&' >response = requests.get(URL, headers=HEADERS) soup = BeautifulSoup(response.content, 'html.parser') items = soup.findAll('div', class_='offer-wrapper') comps = [] for item in items: comps.append(< 'title': item.find('a', class_='marginright5 link linkWithHash detailsLink linkWithHashPromoted').get_text( strip=True), 'price': item.find('p', class_='price').get_text(strip=True), 'link': item.find('a', class_='marginright5 link linkWithHash detailsLink linkWithHashPromoted').get('href') >) global comp for comp in comps: print(f' -> Price: -> Link: ') save() parse()
Это у меня запускается
No_FaP @No_FaP Автор вопроса
SKEPTIC, это и есть весь код
No_FaP @No_FaP Автор вопроса
Traceback (most recent call last):
File «C:\Users\User\Desktop\tester.py», line 33, in
parse()
File «C:\Users\User\Desktop\tester.py», line 23, in parse
‘title’: item.find(‘a’, class_=’marginright5 link linkWithHash detailsLink linkWithHashPromoted’).get_text(
AttributeError: ‘NoneType’ object has no attribute ‘get_text’
[Finished in 0.8s]