380
Permanently Deleted (lemmy.world)
submitted 4 months ago* (last edited 4 months ago) by qaz@lemmy.world to c/memes@lemmy.world

Permanently Deleted

you are viewing a single comment's thread
view the rest of the comments
[-] Deathray5@lemmynsfw.com 2 points 4 months ago

How would you write it, I'm new to python but it reads like they are just trying to make the code not go off the side of the screen?

You do multiline strings with 3 quotes, e.g.:

some_var = “string”
s = f"""
This is a very very very very very very very very very
very very very very very very long {some_var}.
"""

If you don’t want line breaks, you can also do

some_var = “string”
s = (
  f”This is a very very very very very very very very very”
  # note the leading space here
  f” very very very very very very long {some_var}.”
)

But doing it the way shown will render the string something like:

This is a very very very very very very very very very      very very very very very very long {some_var}.

That big block of white space in the middle is not desired.

this post was submitted on 01 Jan 2026
380 points (97.5% liked)

memes

21240 readers
2929 users here now

Community rules

1. Be civilNo trolling, bigotry or other insulting / annoying behaviour

2. No politicsThis is non-politics community. For political memes please go to !politicalmemes@lemmy.world

3. No recent repostsCheck for reposts when posting a meme, you can only repost after 1 month

4. No botsNo bots without the express approval of the mods or the admins

5. No Spam/Ads/AI SlopNo advertisements or spam. This is an instance rule and the only way to live. We also consider AI slop to be spam in this community and is subject to removal.

A collection of some classic Lemmy memes for your enjoyment

Sister communities

founded 2 years ago
MODERATORS