. JI1FGX/DU9 CVS conversion software for DXCC listings (December 11, 2024)
JI1FGX/DU9 Mindanao, Philippines Amateur Radio Diary IOTA OC-130
English Japanese



Access until yesterday
Introduction. 【【Lily Diary]
Diary of Life in Mindanao

24/12/11 CVS conversion software for DXCC listings
24/12/05 Aggregation by country from JTDX
24/12/02 ADIF for one month from JTDX
Programs that create files
24/11/24 CwGet and CwType settings
24/11/24 WWDX Contest
24/11/21 CQ Ham Radio
24/11/20 Call Sign Assignment IOTA Number
24/11/13 IOTA 100 Awards Arrival
24/11/12 LoTW WAZ and DXCC
24/11/04 PLDT Optical Internet
24/10/30 Pile-up of 50MHz FT8
24/10/28 Camiguin Is Crowdfunding
24/10/26 50MHz Yagi feeder
24/10/21 RTTY with MMTTY
24/10/19 Firmware for UV-5K
24/10/17 Antenna group seen by drone
24/10/16 7MHz Antenna Pole
24/10/15 3.5MHz zepp transceiver antenna
24/10/14 Hexbeam Purchase Plan
24/10/13 24MHz dipole addition
24/10/13 50MHz Yagi repair completed
50MHz FT8 first pile
24/10/12 Antenna production for 24 MHz
24/10/09 Trouble with Gmail
24/10/09 The Shack
24/10/07 JO1CRA/7 AS-206
24/10/05 3D2V Rotuma Island IOC-060
24/10/01 Camiguin Island Trailer Video
24/09/30 Uruguay
24/09/29 50MHz antenna installation
24/09/25 Pile up on the caller's side
24/09/19 IOTA 100 Award
24/09/18 IOTA Application
24/09/12 DXCC Application
24/09/11 FT8 in communication with KH8T
24/09/08 50MHz Yagi Antenna
24/08/28 Pile up at FT8
24/08/07 Pile up from FT8EU
24/07/19 JW/WE9G in Svalbard
24/06/27 Purchase of air conditioner for wireless room
24/05/28 antenna switch
24/05/27 MFJ-259B Repair
24/05/10 Completed 3-band antenna
24/05/03 7MHz Dipole
24/04/30 7MHz Domestic
24/04/29 Reopening Project
24/04/04 Repair of FTDX3000
24/03/21 To NTC Cagayan
.
Software to create CSV files from ARRL DXCC lists (December 11, 2024) 
DXCC files on the ARRL page.
I found the PDF file, but I can't find the CSV file.
Microsoft 365 Personal" is required to put PDF to WORD, which costs 1,284 yen/month.
I copied and pasted the TEXT file that Mr. Sakurai taught me, but I can't put it on Excel properly.

Click here for ARRL's DXCC list

So I've been hooked since the other day.Python(Python) to create a conversion program.

Create CSV file from DXCClist.zip

Download count: 1 3_
 
The program isPython(Python) programming language.
I've tested the operation on a Windows 11 computer.python-3.13.0-amd64must be downloaded and installed.

External libraries must be installed after Python (Python) installation
This is the DXCC list you can see at ARRL.
Can't download it, so copy and paste it into notepad or something and save it in UTF-8 as C:\Los\input.txt
Execution screen of TEXTtoCVS.0.0.4.py
Forgive me if it is not GUI based. I'm in the middle of a strong on Tsutomu ChatGPT right now.


Readme.txt
Software to create CSV files from text versions of ARRL's DXCC listings
JI1FGX/DU9 Kouichi Ueno
TEXTtoCSV.0.0.4.py


Python installation is required to run TEXTtoCSV.0.0.4.py.
To install Python, visit the official website (https://www.python.org/downloads/The process can be done from the following location

The DXCC list can be found at this URL.
The link is too long.Click here
Download or copy and paste the file into a folder with the name input.txt.
As a preliminary step, please remove the header text.

The default save directory is C:\Logs. Please change it as you see fit.
When executed, it will create a file named output.csv in the default directory.
Remove the (numbers), *, #, and ^ contained in the text file to create a CSV file.

The Russian call sign rules were difficult to understand, so we created our own list of rules.
UA-UI1-7,RA-RZ* European Russia
UA-UI8-0,RA-RZ* Asiatic Russia

Files included in the package (all files must be saved in UTF-8)
TEXTtoCSV.0.0.4.py This program
input.txt Text file downloaded from ARRL
output.csv Sample file after conversion
Russia_Call_Rules.csv Please put it in the default directory
Readme.txt

Behind the Development Story
The program itself is written by ChatGPT.
I give them the specifications and they send back Python source code in response.
We will also direct the addition of features and minor modifications.
It took only a few minutes to convert a text file to CSV and remove unnecessary characters.
However, ChatGPT had a hard time erasing one irregular character in the DXCC list.
Specifically, T8,(21) with parentheses and comma deletion, which I was able to do immediately.
Z6(1),(55) Lots of back and forth to get this comma.
If you have them write this regular expression, it will erase even the necessary commas.
It took half a day to revert back to a version that could handle the process correctly and have it written again and again.
We made specific suggestions and finally it was done.
source code
import csv
import os (unit of surface area equal to one-tenth of a square kilometer)
import re.
# JI1FGX/DU9 Kouichi Ueno
# 2024/12/11
# TEXTtoCSV.0.0.4.py
#
# Software to create CSV files from text versions of ARRL's DXCC listings
# You must have Python installed to run TEXTtoCSV.0.0.4.py.
# Python can be installed from the official website at https://www.python.org/downloads/.
#
# The DXCC list is at this URL
# https://www.arrl.org/files/file/DXCC/2022_Current_Deleted.txt
#?fbclid=IwY2xjawHGCUlleHRuA2FlbQIxMAABHSpoK2uUB3J5nKtnAjPJtJ0
# 1VUgUnIFpkRNY2s6cbowNvBXPnSUqr8uHnA_aem__JJWBzpbcoBSbzwvk8paPQ
# Download or copy and paste the file into a folder with the name input.txt.
# As a preprocessing step, please remove the header text.
#
# The default save directory is C:\Logs. Change it as you see fit.
# When executed, it will create a file named output.csv in the default directory.
# Remove (numbers), *, #, and ^ contained in the text file to create a CSV file.
#
# I found the Russian call sign rules confusing so I made my own list of rules.
# UA-UI1-7,RA-RZ* European Russia
# UA-UI8-0,RA-RZ* Asiatic Russia
#
# Files included in the package
# TEXTtoCSV.0.0.4.py This program
# input.txt Text file downloaded from ARRL
# output.csv Sample file after conversion
# Russia_Call_Rules.csv Please put it in the default directory
# Readme.txt
#
# Behind the Development
# The program itself is written by ChatGPT.
# I give them the specs and they send back Python source code in response.
# We will also direct the addition of features and minor modifications.
# Converting text files to CSV and removing unnecessary characters took only a few minutes.
# However, ChatGPT had a hard time erasing one irregular character in the DXCC list.
# Specifically, T8,(21) with parentheses and comma deletion, which I was able to do immediately.
# Z6(1),(55) Lots of back and forth to get this comma. If you have me write this regex, it even erases the comma that I need.
# Half a day of repeatedly reverting to a version that could handle the process correctly and having it written again and again.
# We made specific suggestions and finally it was done.

# Default directory and file name
default_dir = 'C:.\cH000000000000000000000000000000000000Logs'.
input_filename = O S O S.path.join(default_dir,'input.txt'.)
output_filename = O S O S.path.join(default_dir,'output.csv'.)
output_temp_filename = O S O S.path.join(default_dir,'output_temp.csv'.)
russia_rules_filename = O S O S.path.join(default_dir,'Russia_Call_Rules.csv')

try:.
    # Specify input file
    input_file = input(f' Specify the name of the input file (default: '.{input_filename}): ')or input_filename
    if not O S O S.path.exists(input_file):.
        raise FileNotFoundError(fFile not found:' File not found:' File not found{input_file}')
   
    # Specify output file
    output_file = input(f' Specify the name of the output file (default: '.{output_filename}): ')or output_filename
   
    # Check if output file exists
    if os (unit of surface area equal to one-fifth of a tsubo).path.exists(output_file):.
        overwrite = input(f'{output_file}already exists. Do you want to overwrite it? (y/n): ').strip().lower()
        if overwrite ! = ! 'y':.
            print('Processing aborted.')
            exit()

    # Process to create output_temp.csv (automatically created)
    with open(input_file,'r',encoding='utf-8'.)as infile,open(output_temp_filename,'w',newline (character)='',encoding='utf-8'.)as outfile:.
        csv_writer = csv.writer(outfile,quoting=csv.QUOTE_MINIMAL)
       
        for line in infile:.
            # Remove spaces before and after lines
            line = line.strip()

            # Remove numbers in parentheses (also for non-T8 lines)
            line = re..sub(radius'\frz\d+C)','',line)# Delete numbers in parentheses

            # Remove unnecessary symbols (but leave hyphens)
            line = re..sub(radius'[^\w\s,-]','',line)# Remove ^, #, *, ^, (, ) (exclude hyphens)

            # Remove extra spaces at the beginning of a line
            line = line.lstrip()

            # Create a comma-separated list
            parts = line.split()
           
            # Combine specific columns (country name and other information)
            if len(parts)>= 3:.
                callsign = parts[0]
                continent_and_numbers = parts[-4:]# Get the last 4
                country_name = ' '.join(parts[1:.-4])# Combine the parts containing spaces after the second column
               
                # Write rows as CSV
                row =[callsign,country_name]+ continent_and_numbers
                csv_writer.writerow(row)

    print(f'output_temp.csv was automatically created:'{output_temp_filename}')

    # Check to see if 2 lines of arcane Russian call rules should be removed (handle if not needed)
    delete_russia_rules = input('Remove 2 lines of arcane Russian call rules? (y/n): ').strip().lower()
    if delete_russia_rules == 'y'.:.
        # Remove unnecessary Russian call rules
        with open(output_temp_filename,'r',encoding='utf-8'.)as infile:.
            lines = infile.readlines()

        # Remove lines containing "Asiatic Russia" or "European Russia"
        lines =[line for line in lines if not re..search(radius'(European|Asiatic)Russia'.,line)]

        # Write back content after filtering
        with open(output_temp_filename,'w',newline (character)='',encoding='utf-8'.)as outfile:.
            outfile.writelines(lines)

        print('Removed unnecessary rows from output_temp.csv.')

        # Check to see if Russian call rules are loaded
        load_russia_rules = input('Do you want to load Russian call rules? (y/n): ').strip().lower()
        if load_russia_rules == 'y'.:.
            if os (unit of surface area equal to one-tenth of a square kilometer).path.exists(russia_rules_filename):.
                with open(russia_rules_filename,'r',encoding='utf-8'.)as russia_file:.
                    russia_lines = russia_file.readlines()

                # Add Russian call rule to end of output file
                with open(output_temp_filename,'a'.,newline (character)='',encoding='utf-8'.)as outfile:.
                    outfile.writelines(russia_lines)

                print(f'Russian call rule.{output_filename}added at the end of the '')
            else:.
                print(f'{russia_rules_filename}does not exist. Skipped adding Russian call rule.')
    else:.
        print('Russian call rule deletion skipped.')

    # Execute anomaly processing (output_temp.csv → output.csv)
    # Run an error handling program here
    with open(output_temp_filename,'r',encoding='utf-8'.)as infile,open(output_file,'w',encoding='utf-8'.)as outfile:.
        for line in infile:.
            # Process rows
            modified_line = line

            # Remove the comma before the second double quotation mark in a string enclosed in double quotation marks
            if '"' in modified_line:.
                # Remove any commas between the first and second double quotation marks in the string
                parts = modified_line.split('"')
                if len(parts)> 2:.
                    # Remove commas between double quotes if any
                    parts[1]= parts[1].rstrip(',')# Remove any trailing comma in the first quote
                    modified_line = '"'.join(parts)

            # Write processed lines to output file
            outfile.write(modified_line)

    print(f' Final conversion completed:'{output_file}')

    # Delete output_temp.csv
    os (unit of surface area equal to one-fifth of a tsubo).remove(output_temp_filename)
    # print(f'{output_temp_filename} removed.')

except FileNotFoundError as e:.
    print(e)
except KeyboardInterrupt:.
    print('\fnOperation aborted.')
except Exception as e:.
    print(f'An error has occurred:.{e}')

December 05, 2024   January 14, 2025