Be sure that info in post[4] could be cast to int .
I can generate the error "ValueError: invalid literal for int() with base 10: ‘H’ " if i do something like that :
The error message invalid literal for int() with base 10 would seem to indicate that you are passing a string that’s not an integer to the int() function . In other words it’s either empty, or has a character in it other than a digit.
You can solve this error by using Python isdigit() method to check whether the value is number or not. The returns True if all the characters are digits, otherwise False .
if val.isdigit():
The other way to overcome this issue is to wrap your code inside a Python try…except block to handle this error.
Not sure if you’ve already figured this out, but saw another post that possibly fixes your issue. If you mistyped your code and appended the title, then you’ll run into the issue of trying to typecast your title into an integer which won’t work. If your code shows this, then fix it to append the entire row for each iteration and it should fix your average comment count step.