Understanding stdin, stdout, stderr in Python

Поделиться
HTML-код
  • Опубликовано: 11 сен 2024
  • Today we learn about the standard streams stdin, stdout and stderr as well as how to use them in Python.
    ◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾
    📚 Programming Books & Merch 📚
    🐍 The Python Bible Book: www.neuralnine...
    💻 The Algorithm Bible Book: www.neuralnine...
    👕 Programming Merch: www.neuralnine...
    💼 Services 💼
    💻 Freelancing & Tutoring: www.neuralnine...
    🌐 Social Media & Contact 🌐
    📱 Website: www.neuralnine...
    📷 Instagram: / neuralnine
    🐦 Twitter: / neuralnine
    🤵 LinkedIn: / neuralnine
    📁 GitHub: github.com/Neu...
    🎙 Discord: / discord

Комментарии • 18

  • @paulthomas1052
    @paulthomas1052 Год назад +4

    250K Subs - congratulations - this has always been a great channel - always informative and interesting. All the best 🤗

  • @user-uk7ul9ym1e
    @user-uk7ul9ym1e 2 месяца назад

    A lot of information, very good to watch after some previous videos about theory if in out and error streams in any OS.

  • @JorgeEscobarMX
    @JorgeEscobarMX Год назад +1

    0:00 I'm wondering if I need this, let's see.

  • @elenakusevska6266
    @elenakusevska6266 6 месяцев назад

    Useful video :) I learned something today :)

  • @JorgeEscobarMX
    @JorgeEscobarMX Год назад

    11:00 print has a flush parameter and I can avoid the printing the new line on print function calls.

  • @rantalbott6963
    @rantalbott6963 11 месяцев назад

    I like to include a function function for printing to stderr so I don't need to keep typing the "file=":
    def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    Most of the time when you're reading from stdin, you'll want to process one line at a time. If you don't need a context manager for some other reason, you can just treat sys.stdin as an iterable:
    for line in sys.stdin:
    if len(line) == 0:
    # End of file. Do final stuff here
    sys.exit(0)
    line = line.rstrip()
    Notice the rstrip(): reading includes the terminating (CR and) LF, and you usually don't want them as part of the data.

  • @harshavardhanlakhinana5280
    @harshavardhanlakhinana5280 6 месяцев назад

    Really useful

  • @sergiuoanes4635
    @sergiuoanes4635 Год назад

    very helpful! thank you

  • @FOXFHEX1
    @FOXFHEX1 Год назад

    Good job ❤

  • @richardboreiko
    @richardboreiko Год назад

    I wonder if that works with logging....

  • @andiglazkov4915
    @andiglazkov4915 Год назад

    Thanks 😊

  • @juggerfps2402
    @juggerfps2402 6 месяцев назад

    thanks

  • @user-td4pf6rr2t
    @user-td4pf6rr2t 18 дней назад

    echo 'i learned' | python3 -c "print(sys.stdin.read(),end='this')"

  • @Little-bird-told-me
    @Little-bird-told-me Год назад

    POPos is no longer my fav distro. nvim is still running on version 6.1.
    You should try a WM in Arch. May be Hyprland or sway

  • @ConsumedKing
    @ConsumedKing Год назад

    Thanks 🤍

  • @philtoa334
    @philtoa334 Год назад

    Thx_.

  • @smartcat5989
    @smartcat5989 Год назад

    information , ℹ️

  • @abdulwaleedjulaid5491
    @abdulwaleedjulaid5491 Год назад

    Zoom your video blurry