Traducción de Código

10 views
Skip to first unread message

Javier Antonio Brito Sanchez

unread,
May 13, 2015, 5:28:39 PM5/13/15
to pytho...@googlegroups.com
Hola me pueden explicar esta parte de código y cómo podria pasarlo a java?


year = int(data['search_year'])
month = int(data['search_month'])
dates = self.util.get_dates(year, month)
txt = browser.find_element_by_id(self.g.SAT['date_from'])
arg = "document.getElementsByName('{}')[0]." \<-----Arg que tipo de variable es y Por qué estos simbolos?
"removeAttribute('disabled');".format(<--------Este format es propio de phyton o se crea?
self.g.SAT['date_from_name'])<--------------Este valor se que lo importan de values.py
browser.execute_script(arg)
txt.send_keys(dates[0])<------------Por qué dates[0]?

saludos.

de antemano gracias por sus comentarios


Alexandro Colorado

unread,
May 13, 2015, 5:30:11 PM5/13/15
to pythoncabal
Creo que eso es pertinente a un grupo de Java no de python...

--
Has recibido este mensaje porque estás suscrito al grupo "PythonCabal" de Grupos de Google.
Para anular la suscripción a este grupo y dejar de recibir sus mensajes, envía un correo electrónico a pythoncabal...@googlegroups.com.
Para publicar en este grupo, envía un correo electrónico a pytho...@googlegroups.com.
Visita este grupo en http://groups.google.com/group/pythoncabal.
Para acceder a más opciones, visita https://groups.google.com/d/optout.



--
Alexandro Colorado
Apache OpenOffice Contributor
882C 4389 3C27 E8DF 41B9  5C4C 1DB7 9D1C 7F4C 2614

Ismael Farfán

unread,
May 13, 2015, 6:02:31 PM5/13/15
to pytho...@googlegroups.com
2015-05-13 16:28 GMT-05:00 Javier Antonio Brito Sanchez
<logi...@transportesbrisa.com.mx>:
> Hola me pueden explicar esta parte de código y cómo podria pasarlo a java?
>
>
> year = int(data['search_year'])
> month = int(data['search_month'])
> dates = self.util.get_dates(year, month)
>
> txt = browser.find_element_by_id(self.g.SAT['date_from'])
>
> arg = "document.getElementsByName('{}')[0]." \<-----Arg que tipo de variable

El "\" al final sirve para indicar que la línea continúa, es solo para
dar formato al código

> es y Por qué estos simbolos?
> "removeAttribute('disabled');".format(<--------Este format es propio de
> phyton o se crea?

help ("".format)
format(...)
S.format(*args, **kwargs) -> string

Return a formatted version of S, using substitutions from args and kwargs.
The substitutions are identified by braces ('{' and '}').


> self.g.SAT['date_from_name'])<--------------Este valor se que lo
> importan de values.py

arg = "document.getElementsByName('{}')[0].removeAttribute('disabled');".format(666)
print arg
document.getElementsByName('666')[0].removeAttribute('disabled');
print arg.__class__
<type 'str'>

> browser.execute_script(arg)
> txt.send_keys(dates[0])<------------Por qué dates[0]?
>

La variable dateS y la función get_dateS parecen estar en plural, así
que supongo que regresa un arreglo... por qué solo la primera,
imprímela a ver que más tiene.


-Farfán


>
> saludos.
>
>
> de antemano gracias por sus comentarios
>
>
>
> --
> Has recibido este mensaje porque estás suscrito al grupo "PythonCabal" de
> Grupos de Google.
> Para anular la suscripción a este grupo y dejar de recibir sus mensajes,
> envía un correo electrónico a pythoncabal...@googlegroups.com.
> Para publicar en este grupo, envía un correo electrónico a
> pytho...@googlegroups.com.
> Visita este grupo en http://groups.google.com/group/pythoncabal.
> Para acceder a más opciones, visita https://groups.google.com/d/optout.



--
Do not let me induce you to satisfy my curiosity, from an expectation,
that I shall gratify yours. What I may judge proper to conceal, does
not concern myself alone.

Javier Antonio Brito Sanchez

unread,
May 13, 2015, 8:04:10 PM5/13/15
to pytho...@googlegroups.com
Gracias Farfan, me sirvió de mucho tu respuesta, con lo que me explicaste pude resolver mi problema y disculpen por publicar aquí pero pense que tengo que entender primero el lenguaje python para pasar el código a java, y como nunca he programado en python la vdd. me esta costando un poco.
Reply all
Reply to author
Forward
0 new messages