Mostrando las entradas con la etiqueta Como. Mostrar todas las entradas
Mostrando las entradas con la etiqueta Como. Mostrar todas las entradas

¿Cómo concatenar int y string en python?

Existen distintas maneras de concatenar un número (INT) y un string (STR)

Error

Para imprimir (print) no es suficiente concatener con +

In [1]:
texto = "hola mundo"
numero = 23
print(texto+numero)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-1-3fbf59f578f0> in <module>()
      1 texto = "hola mundo"
      2 numero = 23
----> 3 print(texto+numero)

TypeError: must be str, not int

Usando la función str

In [2]:
texto = "hola mundo"
numero = 23
print(texto+str(numero))
hola mundo23

Usando format

In [3]:
texto = "hola mundo"
numero = 23
print('{}{}'.format(texto,numero))
hola mundo23

¿Cómo crear y usar un botón en HTML5?

El siguiente es un ejemplo básico de como insertar un botón:
<!DOCTYPE html>
<html>
<body>

<p> Click en el boton</p>
<button type="button" onclick="alert('Hola')">Click</button>
 
</body>
</html>
  1. https://www.w3schools.com/tags/tag_button.asp
  2. https://vinkula.com/crear-botones-personalizados-con-html5-y-css3/

¿Cómo limpiar un input de html con javascript?

Solo tenemos que identificar el elemento y en value asignar '' (un string vacio)
<!DOCTYPE html>
<html>
<body>

<p>Clear the input field when it gets focus:</p>
<input type="text" id="input1">

<button type="button" onclick="miFuncion()">Click</button>
</body>

<script>
function miFuncion(){
 x = document.getElementById('input1');
    x.value='';
}
</script>
</html>
  1. https://stackoverflow.com/questions/17237772/html-how-to-clear-input-using-javascript
  2. https://www.w3schools.com/howto/howto_html_clear_input.asp