Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

US Area Code Scraper

This script scrapes worldatlas's US Area Code Map and parses it to create
a python dict. The dict is then formatted into a copy-pastable code snippet.

Any contributions and suggestions are welcome.

Python (tuple):

us_area_codes_tuple = ( # Alaska
                        907, 
                        # Alabama
                        205, 251, 256, 334, 
                        # Arkansas
                        479, 501, 870, 
                        # Arizona
                        480, 520, 602, 623, 928, 
                        # California
                        209, 213, 310, 323, 408, 415, 510, 530, 559, 562, 
                        619, 626, 650, 661, 707, 714, 760, 805, 818, 831, 
                        858, 909, 916, 925, 949, 951, 
                        # Colorado
                        303, 719, 970, 
                        # Connecticut
                        203, 860, 
                        # District of Columbia
                        202, 
                        # Delaware
                        302, 
                        # Florida
                        239, 305, 321, 352, 386, 407, 561, 727, 772, 813, 
                        850, 863, 904, 941, 954, 
                        # Georgia
                        229, 404, 478, 706, 770, 912, 
                        # Hawaii
                        808, 
                        # Iowa
                        319, 515, 563, 641, 712, 
                        # Idaho
                        208, 
                        # Illinois
                        217, 309, 312, 618, 630, 708, 773, 815, 847, 
                        # Indiana
                        219, 260, 317, 574, 765, 812, 
                        # Kansas
                        316, 620, 785, 913, 
                        # Kentucky
                        270, 502, 606, 859, 
                        # Louisiana
                        225, 318, 337, 504, 985, 
                        # Massachusetts
                        413, 508, 617, 781, 978, 
                        # Maryland
                        301, 410, 
                        # Maine
                        207, 
                        # Michigan
                        231, 248, 269, 313, 517, 586, 616, 734, 810, 906, 
                        989, 
                        # Minnesota
                        218, 320, 507, 612, 651, 763, 952, 
                        # Missouri
                        314, 417, 573, 636, 660, 816, 
                        # Mississippi
                        228, 601, 662, 
                        # Montana
                        406, 
                        # North Carolina
                        252, 336, 704, 828, 910, 919, 
                        # North Dakota
                        701, 
                        # Nebraska
                        308, 402, 
                        # New Hampshire
                        603, 
                        # New Jersey
                        201, 609, 732, 856, 908, 973, 
                        # New Mexico
                        505, 575, 
                        # Nevada
                        702, 775, 
                        # New York
                        212, 315, 516, 518, 585, 607, 631, 716, 718, 845, 
                        914, 
                        # Ohio
                        216, 330, 419, 440, 513, 614, 740, 937, 
                        # Oklahoma
                        405, 580, 918, 
                        # Oregon
                        503, 541, 
                        # Pennsylvania
                        215, 412, 570, 610, 717, 724, 814, 
                        # Rhode Island
                        401, 
                        # South Carolina
                        803, 843, 864, 
                        # South Dakota
                        605, 
                        # Tennessee
                        423, 615, 731, 865, 901, 931, 
                        # Texas
                        210, 214, 254, 281, 325, 361, 409, 432, 512, 713, 
                        806, 817, 830, 903, 915, 936, 940, 956, 972, 979, 
                        # Utah
                        435, 801, 
                        # Virginia
                        276, 434, 540, 703, 757, 804, 
                        # Vermont
                        802, 
                        # Washington
                        206, 253, 360, 425, 509, 
                        # Wisconsin
                        262, 414, 608, 715, 920, 
                        # West Virginia
                        304, 
                        # Wyoming
                        307 )

C (const int array):

const int us_area_codes[241] = { // Alaska
                                 907, 
                                 // Alabama
                                 205, 251, 256, 334, 
                                 // Arkansas
                                 479, 501, 870, 
                                 // Arizona
                                 480, 520, 602, 623, 928, 
                                 // California
                                 209, 213, 310, 323, 408, 415, 510, 530, 559, 562, 
                                 619, 626, 650, 661, 707, 714, 760, 805, 818, 831, 
                                 858, 909, 916, 925, 949, 951, 
                                 // Colorado
                                 303, 719, 970, 
                                 // Connecticut
                                 203, 860, 
                                 // District of Columbia
                                 202, 
                                 // Delaware
                                 302, 
                                 // Florida
                                 239, 305, 321, 352, 386, 407, 561, 727, 772, 813, 
                                 850, 863, 904, 941, 954, 
                                 // Georgia
                                 229, 404, 478, 706, 770, 912, 
                                 // Hawaii
                                 808, 
                                 // Iowa
                                 319, 515, 563, 641, 712, 
                                 // Idaho
                                 208, 
                                 // Illinois
                                 217, 309, 312, 618, 630, 708, 773, 815, 847, 
                                 // Indiana
                                 219, 260, 317, 574, 765, 812, 
                                 // Kansas
                                 316, 620, 785, 913, 
                                 // Kentucky
                                 270, 502, 606, 859, 
                                 // Louisiana
                                 225, 318, 337, 504, 985, 
                                 // Massachusetts
                                 413, 508, 617, 781, 978, 
                                 // Maryland
                                 301, 410, 
                                 // Maine
                                 207, 
                                 // Michigan
                                 231, 248, 269, 313, 517, 586, 616, 734, 810, 906, 
                                 989, 
                                 // Minnesota
                                 218, 320, 507, 612, 651, 763, 952, 
                                 // Missouri
                                 314, 417, 573, 636, 660, 816, 
                                 // Mississippi
                                 228, 601, 662, 
                                 // Montana
                                 406, 
                                 // North Carolina
                                 252, 336, 704, 828, 910, 919, 
                                 // North Dakota
                                 701, 
                                 // Nebraska
                                 308, 402, 
                                 // New Hampshire
                                 603, 
                                 // New Jersey
                                 201, 609, 732, 856, 908, 973, 
                                 // New Mexico
                                 505, 575, 
                                 // Nevada
                                 702, 775, 
                                 // New York
                                 212, 315, 516, 518, 585, 607, 631, 716, 718, 845, 
                                 914, 
                                 // Ohio
                                 216, 330, 419, 440, 513, 614, 740, 937, 
                                 // Oklahoma
                                 405, 580, 918, 
                                 // Oregon
                                 503, 541, 
                                 // Pennsylvania
                                 215, 412, 570, 610, 717, 724, 814, 
                                 // Rhode Island
                                 401, 
                                 // South Carolina
                                 803, 843, 864, 
                                 // South Dakota
                                 605, 
                                 // Tennessee
                                 423, 615, 731, 865, 901, 931, 
                                 // Texas
                                 210, 214, 254, 281, 325, 361, 409, 432, 512, 713, 
                                 806, 817, 830, 903, 915, 936, 940, 956, 972, 979, 
                                 // Utah
                                 435, 801, 
                                 // Virginia
                                 276, 434, 540, 703, 757, 804, 
                                 // Vermont
                                 802, 
                                 // Washington
                                 206, 253, 360, 425, 509, 
                                 // Wisconsin
                                 262, 414, 608, 715, 920, 
                                 // West Virginia
                                 304, 
                                 // Wyoming
                                 307 };

About

Python based script that scrapes worldatlas.com for all current area codes in the US.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Contributors

Languages