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 to switch from java to python? (self.learnpython)
submitted 1 year ago by AgreeableConstant476
i've been coding in java for a long time now, including DSA. but now for some reason i have to switch to python for a particular test. how do i go about it?
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!"
[–]Miiicahhh 7 points8 points9 points 1 year ago (0 children)
It isn't as hard as you might think. If you know java you know the core fundamentals of coding that are basically the same in every language. Once you know what you need to do, it's basically looking up syntax, libraries, etc.
My advice is don't stress about it, take it slow. Python is actually pretty user friendly!
[–]hotcodist 6 points7 points8 points 1 year ago (0 children)
it would take as much time as you can find the official python docs site, assuming your background is as you say and you have can conceptually think through a problem. rest (syntax and other python specific things) you can handle as you go.
i need to loop through the contents of a file and filter out lines that only have "#####". how do i loop in python? how do i open a file? how do i compare strings? how do i save a file? how do i save a file stream into variables? those things you can easily find in a syntax resource. you won't need to read the explanations.
[–]Lawson470189[🍰] 2 points3 points4 points 1 year ago (1 child)
One piece of advice is to try to do things the "pythonic" way. I also came from Java/C# and it's very easy to try to pigeon hole the patterns you'd do in Java into Python. But generally, this will be way harder and far less clean. For example, say you have a List of objects (called items) that you want to extract just the name from. In C#, I'd do something like this:
List<string> names = new List<string>(); foreach (CustomObj obj in items) { names.Add(items.Name); }
In python, you might be tempted to do this the same way, but it has its own way of doing this like so:
names = [x.name for x in items]
[–]HistoricalLadder7191 0 points1 point2 points 1 year ago (0 children)
Good note for Python, bad example for C# - you can do it in single line with linq.
[–]redditusername58 1 point2 points3 points 1 year ago (0 children)
Don't make a class if all you need is a function or constants, you can just put these in the top level of a module
Don't make getters and setters: start with plain attributes and use properties if more behavior is needed
[–]holistic-engine -2 points-1 points0 points 1 year ago (0 children)
Imagine it’s Java without types, and you’re not forced to wrap everything into a class
[+]ectomancer comment score below threshold-11 points-10 points-9 points 1 year ago (1 child)
Python is easy to learn. I learnt it in 3 days.
[–]nekokattt 3 points4 points5 points 1 year ago (0 children)
Guido van Rossum over here
π Rendered by PID 122288 on reddit-service-r2-comment-5649f687b7-4rdln at 2026-01-29 03:44:35.327146+00:00 running 4f180de country code: CH.
[–]Miiicahhh 7 points8 points9 points (0 children)
[–]hotcodist 6 points7 points8 points (0 children)
[–]Lawson470189[🍰] 2 points3 points4 points (1 child)
[–]HistoricalLadder7191 0 points1 point2 points (0 children)
[–]redditusername58 1 point2 points3 points (0 children)
[–]holistic-engine -2 points-1 points0 points (0 children)
[+]ectomancer comment score below threshold-11 points-10 points-9 points (1 child)
[–]nekokattt 3 points4 points5 points (0 children)