Answer the question
In order to leave comments, you need to log in
Invalid literal for int() with base 10:instagram, how to fix?
Tell me how to fix this error, I want to check who is subscribed to my Instagram page and who is not and unsubscribe from them.
Error code
<module>
followers_count, following_count = int(''.join(followers_count.split(','))), int(''.join(following_count.split(',')))
ValueError: invalid literal for int() with base 10: ''
followers_count, following_count = int(''.join(followers_count.split(','))), int(''.join(following_count.split(',')))
if ',' in followers_count or following_count:
followers_count, following_count = int(''.join(followers_count.split(','))), int(''.join(following_count.split(',')))
else:
followers_count, following_count = int(followers_count), int(following_count)
Answer the question
In order to leave comments, you need to log in
Can you please provide the code of the entire module, otherwise it is not clear what content is in followers_count and where it came from.
If I managed to answer your question in the comments to this answer, then please mark my answer with a tick. Thanks
1. The condition is written incorrectly, it will always be fulfilled.
if ',' in followers_count or ',' in following_count:
followers_count
or following_count
contain empty lines. How there was no data there - this is already a question for the code from which page such data was obtained
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question