Python Data Structures #3: String Object

Поділитися
Вставка
  • Опубліковано 12 вер 2024
  • In this video we'll begin by discussing the basics of the Python string, later, we'll open up a coding editor and showcase some of the more important functions built into the object.
    MISTAKE! As pointed out by Akshat Barbhaya, strings in Python are immutable and don't support setting individual characters. Alternatively you can get around this (although I don't recommend it) by converting the string to a list, changing the character, then joining the list back into a string.
    If you're interested in Python GUI development check out my video series starting with: • Python GUI Development...
    Further reading material: docs.python.or...
    The string module contains a number of useful constants and classes, as well as some deprecated legacy functions that are also available as methods on strings. In addition, Python’s built-in string classes support the sequence type methods described in the Sequence Types - str, unicode, list, tuple, bytearray, buffer, xrange section, and also the string-specific methods described in the String Methods section. To output formatted strings use template strings or the % operator described in the String Formatting Operations section. Also, see the re module for string functions based on regular expressions.

КОМЕНТАРІ • 8

  • @akdb21
    @akdb21 5 років тому +6

    2:26 Characters cannot be set as strings are immutable!

    • @BrianFaure1
      @BrianFaure1  5 років тому +3

      Hi Akshat, thanks for catching this mistake, unfortunately UA-cam no longer supports annotations so I can't make it clear that this is incorrect. I'll pin your comment though in hopes people see it and put a message in the description.
      Sorry for any confusion this may have caused, I'm not sure how I let that slip through. I guess I've never tried setting a character specifically and for some reason figured the string was more similar to a list than it actually is.

    • @akdb21
      @akdb21 5 років тому +1

      @@BrianFaure1 No problem! Thanks for amazing videos on data structures in Python!

  • @jingyuchang1885
    @jingyuchang1885 6 років тому

    Very good video Brian! You explain everything so clear! Thanks again for making the videos and sharing them with people who are eager to learn!!

  • @micmike
    @micmike Рік тому

    Hello, yes I do enjoy your videos and teaching method/style. Wish there were more video's to view.

  • @austinmitchell2652
    @austinmitchell2652 6 років тому

    Your videos are great and easy to understand for me, thanks for doing what you do!

  • @jimmorrisshen
    @jimmorrisshen 6 років тому

    Nice video.

  • @RandomShowerThoughts
    @RandomShowerThoughts 5 років тому +2

    man you didn't close the file after reading it, hurts my soul lmfao