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
Hi I have a list of ids separated with commas and I need to take the ids which are divisible to 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)