Thursday, May 2, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 849  / 2 Years ago, mon, july 11, 2022, 7:23:12

Hi I have a list of ids separated with commas and I need to take the ids which are divisible to 3.


More From » python

 Answers
3

This cannot be done with a regex in any useful way.



Depending on your context you can use for example



[i for i in my_ids.split(',') if int(i) % 3==0]


(assuming the string my_ids contains your ids)


[#37688] Tuesday, July 12, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
leddre

Total Points: 180
Total Questions: 113
Total Answers: 108

Location: France
Member since Thu, Oct 27, 2022
2 Years ago
;