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

753    Asked by ankur_3579 in Python , Asked on Apr 14, 2021

I am a 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.


q0tag = dom.getElementsByTagName('hit')[0].toxml() 


q0 = q0tag.replace('','').replace('','') 


q1 = (q0 * 1.2)


when I'm trying to multiply q0 it always showing


TypeError: can't multiply sequence by non-int of type 'float'.


I'm trying to make q0 int or float but it just makes another error


AttributeError: 'NoneType' object has no attribute 'replace'


q0 value is a round number without a decimal.

Answered by Ankur vaish

 ipython vs python

Python is a high-level general-purpose programming language. Python is easy to read, understand and learn. You can build many different types of applications using python, like Web Applications, Desktop Applications, Command Line Utilities, Machine Learning models etc.

IPython is an interactive shell that is built with python. It provides a more useful shell environment to execute python code in REPL (Read Eval Print Loop). It makes it more interactive by adding features like syntax highlighting, code completion etc. IPython also comes with other tools like Jupyter Notebooks etc.



Your Answer

Interviews

Parent Categories