why not
if feature == tableNum:
?
And what are the % signs doing in your path names for the join? I think you're mixed up with model builder inline variable substitution - basically get rid of all the % signs, I have no idea what they're doing. the f string in Joe's post was to place a 'T' before the variable, from what I see, you don't need to do anything like that.
You also have a mix of raw and non raw encoded paths, I prefer r'' paths as they look cleaner.
import arcpy
#Define Geodatabase Path
featureGDB = r"C:\C_M2\arcpy\list\list_Events_SBA_wp.gdb"
tableGDB = r"C:\C_M2\arcpy\list\list_distance.gdb"
#Create Feature List Variable
arcpy.env.workspace = featureGDB
featureList = arcpy.ListFeatureClasses()
#Create Table List Variable
arcpy.env.workspace = tableGDB
tableList = arcpy.ListTables()
#Set table Names to featureList Names equivalent
for table in tableList:
tableNum = table [0:-5]
#Finde Table and Feature from Lists with same Name and join them
for feature in featureList:
if feature == tableNum:
in_data = r"C:\C_M2\arcpy\list\list_Events_SBA_wp.gdb\WP_20200723_001"
in_field = "OBJECTID"
join_table = r"C:\C_M2\arcpy\list\list_distance.gdb\WP_20200723_001_dist"
join_field = "OBJECTID"
fields = ["DISTANCE"]
arcpy.JoinField_management(in_data, in_field, join_table, join_field, fields)