🕵️ SicherheitslückenSerious vulnerability threatens tens of thousands of Exchange servers(03.09.2026 um 19:20 Uhr)
🔧 AI Nachrichten How to automate your Gmail inbox — without AI(05.09.2026 um 12:00 Uhr)
🔧 Programmierungrustup 1.29.1 brings concurrency improvements(03.09.2026 um 04:12 Uhr)
🔧 ProgrammierungRust 1.98.1 fixes miscompilation bug(04.09.2026 um 00:49 Uhr)
🎥 PodcastsBlack Box: The Chatbots | 14 days | Ep 2 – podcast(03.09.2026 um 15:04 Uhr)
🎥 PodcastsBlack Box: The Chatbots | Life Raft | Ep 4 – podcast(03.09.2026 um 16:00 Uhr)
🎥 PodcastsBlack Box: The Chatbots | The Line | Ep 5 – podcast(03.09.2026 um 16:20 Uhr)
🕵️ SicherheitslückenSerious vulnerability threatens tens of thousands of Exchange servers(03.09.2026 um 19:20 Uhr)
🔧 AI Nachrichten How to automate your Gmail inbox — without AI(05.09.2026 um 12:00 Uhr)
🔧 Programmierungrustup 1.29.1 brings concurrency improvements(03.09.2026 um 04:12 Uhr)
🔧 ProgrammierungRust 1.98.1 fixes miscompilation bug(04.09.2026 um 00:49 Uhr)
🎥 PodcastsBlack Box: The Chatbots | 14 days | Ep 2 – podcast(03.09.2026 um 15:04 Uhr)
🎥 PodcastsBlack Box: The Chatbots | Life Raft | Ep 4 – podcast(03.09.2026 um 16:00 Uhr)
🎥 PodcastsBlack Box: The Chatbots | The Line | Ep 5 – podcast(03.09.2026 um 16:20 Uhr)

26 🕛 kürzlich 2 Min Lesezeit
0

str() vs repr() vs print() in Python

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht

While learning Python, I came across three things that look very similar at first:




  • str()

  • repr()

  • print()



Initially, I thought all of them simply display output.

But after exploring deeper, I realized they actually serve different purposes.






The Core Idea




  • str() ---> user-friendly representation

  • repr() ---> developer/debugging representation

  • print() ---> displays output on the screen






Let's understand the things in detail



str() is used when we want output that is clean and readable for humans.



Notice something interesting?



Quotes are visible here.



That's because repr() is meant more for developers and debugging.






A Better Example



Now let’s take a string containing a newline character:





What’s Happening Here?




  • str() shows the readable version

  • repr() shows the raw/internal representation



That’s why \n is visible inside repr().






So What Does print() Do?



print() is simply used to display output.





If you have noticed....Internally, print() usually uses str() to display objects.






Final Understanding



Function | Purpose

str() | Human-readable output

repr() | Developer/debugging output

print() | Displays output






Final Thoughts



At first, these functions looked almost identical to me.



But understanding the difference between readable output and internal representation made Python behavior much clearer — especially for debugging and understanding objects deeply.



Small concept, but very powerful.

Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 53%
🟡 In Evaluierung 26%
🟢 Keine Auswirkung 10%
Spannende Innovation 11%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
1 Quelle
GPT-6 Astra is the first model making OpenAI willing to declare the "AGI era"
1 Quelle
Deepmind put 100 AI agents in a room and they sorted into cheaters, converts, and whistleblowers
1 Quelle
Serious vulnerability threatens tens of thousands of Exchange servers
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten str() vs repr() vs print() in Python

Thematisch verwandte Begriffe: repr, print, Python · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...