#๐Ÿ”’ can somebody explain what the junk is string module

28 messages ยท Page 1 of 1 (latest)

wraith sonnet
#

i don't understand the string module

twilit jackalBOT
#

@wraith sonnet

Python help channel opened

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.

flat hill
twilit jackalBOT
flat hill
#

!e

import string

print(dir(string))
twilit jackalBOT
# flat hill !e ```py import string print(dir(string)) ```

:white_check_mark: Your 3.12 eval job has completed with return code 0.

['Formatter', 'Template', '_ChainMap', '__all__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', '_re', '_sentinel_dict', '_string', 'ascii_letters', 'ascii_lowercase', 'ascii_uppercase', 'capwords', 'digits', 'hexdigits', 'octdigits', 'printable', 'punctuation', 'whitespace']
flat hill
#

it has all sorts of pre-defined strings for u to use

#

to simplify code

spiral glen
flat hill
#

that has a better documentation ye

wraith sonnet
#

thnks dagger thnks guys youu're soo helpful and kind

flat hill
spiral glen
#

There's a heap of stuff in there.

#

The format stuff is... complex and ... sometimes useful. Format strings go a long way there days, but sometimes you want to control the formatting.

flat hill
#

i was curious about template rather than format pithink

spiral glen
#

I've never used it myself.

#

BTW, there are template strings in Python now. A related use case.

flat hill
#

if not then please enlighten me

spiral glen
#

Now, something else. Maybe it's not in yet. I'll try to find the Python discussion...

#

!pep 750

twilit jackalBOT
spiral glen
#

Not out yet it seems.

flat hill
#

3.14 makes sense

spiral glen
twilit jackalBOT
#
Python help channel closed for inactivity

This help channel has been closed. 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.