Python Forum: Questions and Answers

#проект
#работа
#книга
#урок
#debug
#jupyter
#venv
#pip
#оптимизация
#интервью
#продвинутый
#новичок
#игра
#автоматизация
#базы_данных
#ии
#парсинг
#боты
#веб
#asyncio
#tkinter
#requests
#matplotlib
#pandas
#numpy
#flask
#django
#python3
#python2
#совет
#обсуждение
#пример
#ошибка
#помощь
#вопрос
#python
#метакласс
#асинхронность
#многопроцессорность
#многопоточность
#контекстный_менеджер
#assert
#logging
#исключение
#try_except
#итератор
#генератор
#строка
#кортеж
#множество
#словарь
#список
#полиморфизм
#инкапсуляция
#метод
#ооп
#декоратор
#lambda
#рекурсия
#функция
#match_case
#тернарный
#break_continue
#Циклы
#Условия
аватар форума byte_coder11 · 2026-05-09 05:46:38 ·
Fatal error: Unexpectedly found nil while unwrapping an Optional value — what does it mean and how to fix it?
Hello everyone! I just started learning Swift, and I keep getting this error. I'm writing a simple app — a task list. When I try to read the task name from a text field and add it ...
аватар форума dev_junior14 · 2026-05-09 05:45:57 ·
TypeScript Error: "An index signature parameter type cannot be a union type" — how to fix?
Hello, colleagues! I'm new to TypeScript and encountered an error I can't understand. There is an object that stores settings for different user types: 'admin' and 'user'. I want t...
аватар форума learn_code40 · 2026-05-09 05:44:43 ·
TypeScript Error: Type 'string | undefined' is not assignable to type 'string' — how to fix?
Hi! I'm new to TypeScript and encountered a confusing error. I have an interface for a user where the `name` field is optional (can be `undefined`). I'm trying to get this name and...
аватар форума js_student49 · 2026-05-09 05:42:37 ·
In Java: implements Runnable vs extends Thread — which to choose?
Hello everyone! I started learning multithreading in Java and got confused about a basic point. We create threads in two ways: either by extending the Thread class or by implementi...
аватар форума debug_master16 · 2026-05-09 05:42:30 ·
Error TS2304: Cannot find name 'require' in TypeScript — how to fix?
Hi! I just started learning TypeScript and am trying to use the Node.js fs module to work with files. I'm writing a simple script that reads a file: ```typescript const fs = requi...
аватар форума learn_code24 · 2026-05-09 05:39:55 ·
Swift: print() vs println() vs NSLog() — what to choose for logging?
Hello everyone! I'm a beginner iOS developer writing my first app in Swift. I've encountered that several different functions can be used to output messages to the console: `print(...
аватар форума dev_junior14 · 2026-05-09 05:39:20 ·
Why emoji characters like 👩‍👩‍👧‍👦 behave strangely in Swift strings?
Hello everyone! I'm writing an iOS app that processes texts with emojis. And I encountered strange behavior in Swift when working with multi-component emojis, especially families a...
аватар форума alex_dev66 · 2026-05-09 05:38:45 ·
Jackson/Kotlin: No Creators, like default construct, exist — deserialization error
Hello everyone! I'm new to Kotlin and trying to use Retrofit + Jackson for parsing JSON in Android. I have a simple data class: ```kotlin data class User( val id: Int, val...
аватар форума debug_master60 · 2026-05-09 05:31:48 ·
Initializing Properties in Kotlin: by lazy or lateinit — Which to Choose?
Hello everyone! I just started learning Kotlin and ran into a problem. I'm writing a small application, and I need to initialize some class properties, but their values become know...
аватар форума program_me63 · 2026-05-09 05:28:57 ·
App crashes with error "Unfortunately MyApp has stopped" — how to fix?
Hello everyone! I'm a beginner in Android development with Kotlin, and I've encountered a problem. My app crashes with the message "Unfortunately MyApp has stopped" immediately aft...
аватар форума alex_dev10 · 2026-05-09 02:59:31 ·
PHP error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM (::) — what does it mean?
Hi everyone! I just started learning PHP and encountered a strange error that I can't understand. I'm trying to call a static method from a class, but PHP gives: ``` Parse error: ...
аватар форума program_me80 · 2026-05-09 02:58:16 ·
tsconfig.json Error: Build: No inputs were found in config file — how to fix?
Hi everyone! I'm new to TypeScript and using Visual Studio 2015 with ASP.NET Core. I created a project, added a `tsconfig.json` file to the root, but when compiling I get an error:...
аватар форума dev_junior32 · 2026-05-09 02:53:43 ·
TypeScript Error: Type 'string' is not assignable to type — how to fix?
Hello everyone! I just started learning TypeScript and encountered an unclear error. I have an interface for a user: ```typescript interface User { name: string; age: number; ...
аватар форума js_student91 · 2026-05-09 02:52:52 ·
JAR file won't start: "no main manifest attribute" — what to do?
Hello everyone! I'm a beginner in Java and trying to build a simple calculator into a JAR file to run it by double-click or via console. Compilation succeeds, but when I run java -...
аватар форума byte_coder51 · 2026-05-09 02:51:45 ·
SQL injection bypassing mysql_real_escape_string() — how to protect?
Hello everyone! I'm a beginner PHP developer, and I'm troubled by one question. I've read that the `mysql_real_escape_string()` function (or its analog `mysqli_real_escape_string()...
аватар форума code_learner79 · 2026-05-09 02:51:22 ·
Grouping data in LINQ (Group By) — how to correctly group a list of objects?
Hello everyone! I'm a beginner in C# and trying to understand data grouping using LINQ. I have a list of orders in an online store. Each order contains a client ID, product name, a...
аватар форума byte_coder10 · 2026-05-09 02:47:30 ·
Kotlin compilation error: compileDebugKotlin — what to do?
Hi everyone! I just started learning Kotlin for Android and encountered a problem when building the project. Gradle throws an error: ``` Error:Execution failed for task ':app:comp...
аватар форума learn_code55 · 2026-05-09 02:43:33 ·
TypeScript Error: Type 'string | undefined' is not assignable to type 'string' — how to fix?
Hello! I just started learning TypeScript and encountered an error I can't understand. I have a function that takes a string and returns its length. But when I try to pass a value ...
аватар форума code_learner13 · 2026-05-09 02:41:56 ·
In Java: implements Runnable vs extends Thread — which to choose for creating a thread?
Hello everyone! I started learning multithreading in Java and got confused about two approaches to creating threads. Everywhere it says that you can either extend the Thread class ...
аватар форума learn_code53 · 2026-05-09 02:41:46 ·
Error TS2304: Cannot find name 'require' in TypeScript — how to fix?
Hello everyone! I'm new to TypeScript and trying to migrate my Node.js project from plain JavaScript. I have a simple file where I import modules using require: ```typescript // i...
аватар форума code_learner69 · 2026-05-09 02:39:14 ·
Why emoji sequences like 👩‍👩‍👧‍👦 behave strangely in Swift strings?
Hi! I'm new to Swift and trying to understand string handling with emoji. I encountered very strange behavior with the family emoji 👩‍👩‍👧‍👦 (two women, a girl, and a boy). In Xcode...
аватар форума js_student37 · 2026-05-09 02:36:24 ·
Type Checking in C#: typeof, GetType() or is — what and when to use?
Hello everyone. I'm a beginner C# developer and I constantly get confused with type checks. There are three ways: `typeof`, the `GetType()` method, and the `is` operator. For exa...
аватар форума js_student23 · 2026-05-09 02:33:16 ·
Property Initialization in Kotlin: `by lazy` vs `lateinit` — when to use what?
Hi everyone! I'm switching from Java to Kotlin and I'm struggling to understand the difference between `by lazy` and `lateinit` for lazy property initialization. They both seem to ...
аватар форума debug_master90 · 2026-05-09 02:31:57 ·
Error "Could not find a declaration file for module" in TypeScript — how to fix?
Hello! I am a beginner TypeScript developer and encountered a problem when importing a third-party module. I have a simple Express.js project written in TypeScript. I installed the...
аватар форума danmodenov@mail.ru · 0000-00-00 00:00:00 · декоратор, метод, многопроцессорность, парсинг
What does if __name__ == "__main__" do?
What happens during a call  if __name__ == "__main__":? # Threading Example import time, thread def MyFunction(string, sleeptime, lock, *args): while 1: lock.a...
аватар форума question@mail.ru · 0000-00-00 00:00:00 · функция, python, пример
The best way to swap letters "A" and "B"
There is a function that takes an argument as a string consisting of "A", "a", "B" and "b".Each "B" should be replaced with "A", each "A" with "B", and the same for lowercase.Examp...
аватар форума question@mail.ru · 0000-00-00 00:00:00 · python, вопрос, пример, ии, работа
Encoding text to arbitrary binary code and back. Example: "A" <-> "01100011"
I need to convert a string, for example ""А"", into a binary code string, for example ""01100011"", then process the binary code a bit by passing it through an "Exclusive OR" funct...
аватар форума dev_junior58 · 2026-05-09 07:08:41 ·
How to programmatically trigger a tap gesture handler on a UIView in Swift?
Hello! I'm a beginner in iOS development with Swift, and I have a problem. I added a UITapGestureRecognizer to a UIView, and it works perfectly when the user taps the view manually...
аватар форума dev_junior39 · 2026-05-09 07:08:14 ·
What is // MARK in Swift and how to use this directive correctly in Xcode?
Hello everyone! I'm a beginner iOS developer, learning Swift for about a month. I've noticed that in other people's projects, comments like `// MARK: - ...`, `// TODO: ...`, and `/...
аватар форума code_learner82 · 2026-05-09 07:07:43 ·
Converting String to Date in Swift: Complete Guide
Hi everyone! I'm new to Swift and can't figure out converting a string to a Date object. My task is to get a date from a string in the format "2023-10-15 14:30:00", but I keep gett...
аватар форума program_me36 · 2026-05-09 07:07:18 ·
Extracting Regular Expression Matches in Swift
Hello everyone! I'm new to Swift and trying to extract data from a string using regular expressions. I have a string like: "Hello, my name is Ivan, I'm 25 years old, I live in Mosc...
аватар форума stack_user85 · 2026-05-09 07:07:14 ·
How many levels of pointer indirection can there be in C++?
Hi everyone. I've been writing in C++ for about a year, and one theoretical question has been bothering me. I know you can create pointers to pointers, like `int** ptr`, and even t...
аватар форума alex_dev68 · 2026-05-09 07:06:50 ·
What is a virtual base class in C++ and why is it needed in multiple inheritance?
Hello everyone! I recently started learning C++ and encountered a problem when using multiple inheritance. I have a base class `Animal`, from which `Bird` and `Mammal` are derived....
аватар форума program_me68 · 2026-05-09 07:06:49 ·
Warning "Expression of type UIViewController? is unused" in Xcode 8/Swift 3
Hello everyone! I'm new to Swift and encountered an unclear warning in Xcode 8 when working with iOS 10. I have simple code that shows a controller via storyboard:\n\n```swift\nlet...
аватар форума stack_user31 · 2026-05-09 07:06:29 ·
HTTP POST request in Swift: how to pass parameters and handle response?
Hello everyone! I'm a beginner in Swift and iOS development. I'm writing a simple app to send data to a server via a POST request. I have a URL and a set of parameters (e.g., usern...
аватар форума alex_dev52 · 2026-05-09 07:06:25 ·
#pragma once vs include guards: what to choose to prevent multiple inclusion?
Hello everyone! I'm a beginner C++ developer and I've already encountered the problem of double inclusion of header files several times. For example, I have this code:\n\n// math_u...
аватар форума learn_code86 · 2026-05-09 07:05:58 ·
How to split a string into tokens (words) in C++? Detailed guide
Hello everyone! I just started learning C++ and encountered a problem that seems simple, but I can't find a normal solution. I need to split a string into individual words (tokens...
аватар форума stack_user13 · 2026-05-09 07:05:57 ·
How to add a full-screen gradient background in an iOS app using Swift?
Hi everyone! I'm a beginner in iOS development with Swift and I've run into a problem. I want to create a beautiful gradient background for the entire screen in my app. I've heard ...
аватар форума program_me91 · 2026-05-09 07:05:27 ·
How to check if an element is contained in std::set in C++?
Hello everyone! I recently started learning C++ and encountered a problem: I need to check if a certain value is in the `std::set` container. I know that `std::set` stores unique e...
аватар форума js_student15 · 2026-05-09 07:05:26 ·
Changing status bar color for individual ViewControllers in iOS 8 on Swift
Hi everyone! I'm new to Swift and iOS development. I'm writing an app that should support iOS 8. I've encountered a problem: I need the status bar text color (at the top of the scr...

Interesting