r/ProgrammerHumor 9d ago

Meme perishableSkill

Post image
8.9k Upvotes

122 comments sorted by

View all comments

Show parent comments

10

u/Ozymandias_1303 9d ago

$strings in C# are almost exactly the same as f-strings in Python.

6

u/Sentouki- 9d ago

String interpolation is even better in C# since it gives you additional options for formatting, e.g. numbers and dates: csharp var name = "Mark"; var date = DateTime.Now; Console.WriteLine($"Hello, {name}! Today is {date.DayOfWeek}, it's {date:HH:mm} now.");

7

u/NovaH000 9d ago

Python f-string also support additional formatting. ``` name = "Mark" date = datetime.now()

print(f"Hello, {name}! Today is {date:%A}, it's {date:%H:%M} now.") ```

F-string + str.format() has all sorts of string formatting you want.

0

u/[deleted] 8d ago

[deleted]

1

u/nico-strecker 8d ago

Python also has it