+ 1

WhatsApp contact extract from group file. I need help.

I export a group file to my phone and I try to write a code to write out all the contact in the file but I was getting errors. x = "<Media omitted>4/28/22, 8:37 PM +234 701 374 7633: <Media omitted>4/28/22, 9:14 PM +234 813 674 7617 1e4/28/22, 11:10 PM +234 913 729 8759 left4/28/22, 11:07 PM +234 701 374 7633: <Media omitted>4/29/22, 12:33 AM +234 802 895 7050 left4/29/22, 2:00 AM +234 816 345 1705 left4/29/22, 4:08 AM +234 818 100 8879 left4/29/22, 7:29 AM +234 701 374 7633: <Media omitted>4/29/22, 7:37 AM +234 701 374 7633: <Media omitt''ed>" for c in x: if c ==("+" +" "+num(len(13))): print(c) OUTPUT Traceback (most recent call last): File "file0.py", line 3, in <module> if c ==("+" +" "+num(len(13))): NameError: name 'num' is not defined

22nd Jul 2022, 2:40 AM
Kayode
Kayode - avatar
3 Answers
+ 3
You forgot to attach the code bit link. Add code bit link in post Description Ensure the <x> string contains data exactly as it is in the file. It doesn't seem to be well structured as it is now. https://www.sololearn.com/post/75089/?ref=app
22nd Jul 2022, 2:51 AM
Ipang
+ 2
https://code.sololearn.com/c3GD7A2Vy3zy/?ref=app
22nd Jul 2022, 8:20 AM
Kayode
Kayode - avatar
0
Kayode Did you solve this yet? I don't understand how the records are structured in that file. Looking at the string <x> it obviously not in XML nor JSON format, and there are inconsistencies. Some numbers have "left" on the beginning of (what seems to be) the record, some don't ... If you have a link where I can read more about the structure of the file, I'd be interested. Also how did you get to export group contacts? I saw some examples online when I searched, but they mostly show how to export to Excel, not a file like this. P.S. Please put Python in post tags, no point in tagging 'anylanguage' when your code was in Python.
23rd Jul 2022, 1:41 PM
Ipang