Unable to convert a string to an integer. Getting Error:
ValueError: invalid literal for int() with base 10: '2674'
I have read many answers and most of them the reason for not working is because it is a float and people use int(), but here clearly it is an integer.
like1 = '2,674 likes'
number = int(like1.split()[0])
print('This is the numer ::',number)
I expect the code to run without an error and print out the number. My actual implementation is to compare it with an integer. For eg. number > 1000, but that throws up the error that you can't compare a string and int, therefore I wanted to modify it into an int. I did not want to post that code since it was pretty big and messy.
Please ask for clarifications, if I have missed any required details!