Skip to content
Advertisement

Python : TypeError: can’t multiply sequence by non-int of type ‘float’

I am newbie programmer trying to make an irc bot that parse xml and paste its content on a channel. Usually i find my answer on google, but this time i can’t find my answer.

JavaScript

when i’m trying to multiply q0 it always showing

JavaScript

Im trying to make q0 int or float but it just make another error

JavaScript

q0 value is a round number without decimal.

Advertisement

Answer

Your q0 value is still a string. This is basically what you’re doing:

JavaScript

To fix it, convert the string to a number first:

JavaScript

You might also want to look into the lxml and BeautifulSoup modules for parsing XML.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement