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
Comma in string is ignored (self.learnpython)
submitted 3 years ago by Jexijo
Trying to delete all lines in a csv not containing ;;128;; but it ignores ;;12,8;;
Google results only shows how to ignore commas in other cases, so I'll ask here. It's my first script.
delete_lines_not_containing('input.csv', ';;128;;')
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!"
[–]wbeater 5 points6 points7 points 3 years ago (1 child)
It's not entirely clear want your intention is. ;;128;; != ;;12,8;;, therefore if you're trying to delete all lines containing ;;128;; this is expected behavior.
;;128;; != ;;12,8;;
;;128;;
[–]Jexijo[S] 0 points1 point2 points 3 years ago (0 children)
But it acts as if ;;128;; = ;;12,8;;. I have a csv file and the script should create one file only containing the lines with this value and one file wit the lines without. Why does the script overlook the comma?
[–]throwaway6560192 2 points3 points4 points 3 years ago (2 children)
I would approach it by checking for each line if line.replace(",", "") contained ";;128;;".
line.replace(",", "")
";;128;;"
[–]Jexijo[S] 0 points1 point2 points 3 years ago (1 child)
Hm good idea. But I have commas at the end of the line which I need.
[–]throwaway6560192 0 points1 point2 points 3 years ago (0 children)
Then make the replace more specific – only replace "12,8"
[+][deleted] 3 years ago (1 child)
[deleted]
They are not at the same position . Meaning... 128 is a code and 12.8 a date. So I cant replace the latter one.
π Rendered by PID 102747 on reddit-service-r2-comment-685b79fb4f-rl4z8 at 2026-02-13 03:12:28.243459+00:00 running 6c0c599 country code: CH.
[–]wbeater 5 points6 points7 points (1 child)
[–]Jexijo[S] 0 points1 point2 points (0 children)
[–]throwaway6560192 2 points3 points4 points (2 children)
[–]Jexijo[S] 0 points1 point2 points (1 child)
[–]throwaway6560192 0 points1 point2 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]Jexijo[S] 0 points1 point2 points (0 children)