#π Leetcode?!
34 messages Β· Page 1 of 1 (latest)
@pliant perch
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
you have to remove the numbers too python says they are alphanumberical but they aren't
str.isalnum()```
Return `True` if all characters in the string are alphanumeric and there is at least one character, `False` otherwise. A character `c` is alphanumeric if one of the following returns `True`: `c.isalpha()`, `c.isdecimal()`, `c.isdigit()`, or `c.isnumeric()`.
So I shall not remove [0, ...., 9] and [a, ..., z]? π€
Thank you so much! I learned a new built-in function in Python today π
What is the difference between built-in and stdlib?
builtins don't need to be imported and can be accessed without a .x form
!d builtins
This module provides direct access to all βbuilt-inβ identifiers of Python; for example, builtins.open is the full name for the built-in function open().
This module is not normally accessed explicitly by most applications, but can be useful in modules that provide objects with the same name as a built-in value, but in which the built-in of that name is also needed. For example, in a module that wants to implement an open() function that wraps the built-in open(), this module can be used directly:
basically, every file has an implicit from builtins import * at the top.
And I can't see it because it's hidden and invisible to the programmer? π€
Yes.
Fun fact: If you add a new attribute to the builtins module, any newly imported modules will also have that new attribute.
If for whatever reason you never need to shadow a builtin with a variable, you can always access it via the builtins module.
Does it mean that from builtins import * is the mother of all files?
I don't think so.
And what about stdlib functions? Is there also a from ... import ...?
stdlib just means it comes standard with python
you can import it without installing any extra packages
stdlib: standard library
So there is also a background mechanism I can't see, but use?
Yes π
basically.
It gets complicated, but that's the gist of it.
sorry for going on a tangent btw
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.