Last active
July 5, 2022 08:50
-
-
Save kd0g/87f629e29857865f7599049359a67e05 to your computer and use it in GitHub Desktop.
iOS padOS 에서 전화번호 바꾸기 스크립트(pythonista필요)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import contacts | |
ppls = contacts.get_all_people() | |
changed = False | |
for p in ppls: | |
for phone in p.phone: | |
y, pnum = phone | |
if pnum.startswith('010'): | |
pnum = pnum.replace('010', '+82 10', 1) | |
print(p.phone) | |
p.phone = [(y, pnum)] | |
changed = True | |
if changed: | |
contacts.save() |
제가 파이썬이 주 언어가 아니라 잘 모르긴하는데
pnum = pnum.replace('010', '+82 10')
와 같이 replace하면 전체문자열에서010
이 모두+82 10
으로 변경되어서
전화 번호가01001001001
일경우+82 10+82 10+82 1001
로 변경 되지 않을까여?
뒤에 count를 붙혀줘서 변경 할 횟수를 지정해야될듯합니다.
그러게요; 왠지 제가 갖고 있는 연락처 중에도 잘못 변환된 전화번호 있을 것 같습니다.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
제가 파이썬이 주 언어가 아니라 잘 모르긴하는데
pnum = pnum.replace('010', '+82 10')
와 같이 replace하면 전체문자열에서010
이 모두+82 10
으로 변경되어서전화 번호가
01001001001
일경우+82 10+82 10+82 1001
로 변경 되지 않을까여?뒤에 count를 붙혀줘서 변경 할 횟수를 지정해야될듯합니다.