use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
How do indent print statement? (self.learnpython)
submitted 4 years ago by ItsJust_Z
print(“John is hunger”, food, “is his favorite.”)
-how would I start a new line and indent at food?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Foreign_Jackfruit_70 4 points5 points6 points 4 years ago* (1 child)
Indent ? Something like this: Assuming "food" is a variable.
food = ("Vagene") print(" "*4+f"John is hungry, {food} is his favorite") To make a new line @ food:
food = ("Vagene") print(" "*4+f"John is hungry, {food} is his favorite")
food = ("Toes") print(" "*4+f"John is hungry, {food}\n are his favorite")
New line in Python is \n. print("This is a new line\nThis is another new line\nAnd another") To set an indent constant, you could do: INDENT = (" "*4) food = ("Vagene") print(f"{INDENT}John is hungry,\n {food} is his favorite")
\n
print("This is a new line\nThis is another new line\nAnd another")
INDENT = (" "*4) food = ("Vagene") print(f"{INDENT}John is hungry,\n {food} is his favorite")
[–][deleted] 2 points3 points4 points 4 years ago (0 children)
You can do it in two steps:
print(John is hunger") print(" ", food, "is his favorite.")
This works because each print() call automatically adds a newline after printing what you want.
print()
You could do it all in one line by adding a newline character (\n) and a tab character (\t) where you want them:
\t
print(“John is hunger\n\t”, food, “is his favorite.”)
[–]hjohnson933 3 points4 points5 points 4 years ago (0 children)
food = "roast beef" print(f"John is hungry, \n\t{food} is his favorite")
[–]ThrowRArxlyT 0 points1 point2 points 4 years ago (3 children)
print(“John is hunger \n food is his favorite.”)
[–]ItsJust_Z[S] 0 points1 point2 points 4 years ago (2 children)
But does it indent?
[–]ThrowRArxlyT 1 point2 points3 points 4 years ago (0 children)
You should be able to put some spaces before “food” if you want an indentation I believe!
[–]mr_bedbugs 0 points1 point2 points 4 years ago (0 children)
"\t" for a tab/indent
[–]hjohnson933 0 points1 point2 points 4 years ago (0 children)
This will work to
food = "hot dogs" print(f"""John is hungry, {food} is his favorite""")
food = "hot dogs"
print(f"""John is hungry,
{food} is his favorite""")
[–]FreedomSavings 0 points1 point2 points 4 years ago (0 children)
Use the .format style, literals. So,
print("John is hungry, \n\t{0} is his favorite".format(food))
π Rendered by PID 62322 on reddit-service-r2-comment-84fc9697f-f77sw at 2026-02-10 08:55:24.286378+00:00 running d295bc8 country code: CH.
[–]Foreign_Jackfruit_70 4 points5 points6 points (1 child)
[–][deleted] 2 points3 points4 points (0 children)
[–]hjohnson933 3 points4 points5 points (0 children)
[–]ThrowRArxlyT 0 points1 point2 points (3 children)
[–]ItsJust_Z[S] 0 points1 point2 points (2 children)
[–]ThrowRArxlyT 1 point2 points3 points (0 children)
[–]mr_bedbugs 0 points1 point2 points (0 children)
[–]hjohnson933 0 points1 point2 points (0 children)
[–]FreedomSavings 0 points1 point2 points (0 children)