Python Basics: Unterschied zwischen den Versionen

Aus MattWiki
Keine Bearbeitungszusammenfassung
Keine Bearbeitungszusammenfassung
 
Zeile 35: Zeile 35:
* https://docs.python.org/3/whatsnew/3.12.html#pep-701-syntactic-formalization-of-f-strings
* https://docs.python.org/3/whatsnew/3.12.html#pep-701-syntactic-formalization-of-f-strings
* https://docs.python.org/3/library/string.html#template-strings
* https://docs.python.org/3/library/string.html#template-strings
== Built-in Functions ==
https://docs.python.org/3/library/functions.html


== Classes and Object Methods ==
== Classes and Object Methods ==
https://docs.python.org/3/reference/datamodel.html#emulating-container-types
https://docs.python.org/3/reference/datamodel.html#emulating-container-types
[[Kategorie:Python]]
[[Kategorie:Python]]

Aktuelle Version vom 30. November 2024, 20:55 Uhr

This article contains my notes on the Python programming language as of Python 3.x.

Operators

https://www.codecademy.com/resources/docs/python/operators

https://docs.python.org/3/reference/lexical_analysis.html#operators

Strings

F-Strings

a = "Munich"
b = "Frankfurt"
c = "Berlin"

# f-String
print(f"We are doing a road trip from {a} through {b} to {c}")

Template Strings

a = "Munich"
b = "Frankfurt"
c = "Berlin"

# Template string
template = "We are doing a road trip from {} through {} to {}"
print(template.format(a, b, c))
# equivalent to:
print("We are doing a road trip from {} through {} to {}".format(a, b, c))

Further reading:

Built-in Functions

https://docs.python.org/3/library/functions.html


Classes and Object Methods

https://docs.python.org/3/reference/datamodel.html#emulating-container-types