Questions tagged as 'python-2.7'

0
answers

Mysql + Python (Save Login in Variable to make Connection)

import os import getpass import mysql.connector class AcessDataBase(): UserName = "" PassWard = "" DataBase = "" def LoginDB(self): self.UserName = input("Username: ") os.system("cls") self.PassWard = getpass.getpass("Passwa...
asked by 08.02.2018 / 12:39
4
answers

How do I put a Python module in a folder other than my script?

I am trying to run a script in Python ( v2.4 and v2.7 ) and created a module with some methods. Unfortunately this module needs to be in a separate folder. At Python documentation and up to here in Stack Overflow I found numerous post tal...
asked by 25.04.2014 / 22:11
1
answer

Add indexes of a vector respecting condition

I have the following code: import random usuarios = 2 APs = 2 distancias = random.sample(range(0, 100), usuarios*APs) teste = [sum(distancias[x: x + usuarios]) for x in range(0, len(distancias), usuarios)] print(teste) This code creates a...
asked by 21.12.2017 / 02:17
2
answers

Program to ask multiplication questions

I want to make a program in Python (2.7.14) that generates two numbers randomly (from 0 to 10), multiply them, ask the result to the user, and display if the result is correct or wrong, until it is typed the string "end", my code looks like thi...
asked by 02.12.2017 / 16:20
1
answer

Problem with encode / decode python

I have 2 functions, the first prepares the html and writes to a .txt file so that the second function opens this file and manages an email through outlook. In the body of the message, the content of this html will be placed with the correct form...
asked by 28.11.2017 / 03:24
1
answer

Error in pyautogui, values

I want to create a macro that performs some tasks. [OK] Step 1: Remember the X and Y . COD: def recordMouse(): time.sleep(5) print "New record in 3s" x, y = pyautogui.position() c = open('Position.txt', 'a') c.write(str(x) + ":" + st...
asked by 23.10.2017 / 17:33
1
answer

Error in pyhon, pyautogui

I created a bot (macro) which has the function of making a few clicks on X time. I made the loop for this. def afkLoop(): #Loop pycontrol.broken() #Função time.sleep(1800) #Timer afkLoop() def broken(): #Função print "["+(str...
asked by 26.10.2017 / 00:51
1
answer

Convert document word (DOC) to pdf using python

I would like to convert a word document (doc) to pdf using python 2.7 . I have this script, but I did not understand anything about it. import sys import os import comtypes.client wdFormatPDF = 17 in_file = os.path.abspath(sys.argv[1]) o...
asked by 13.10.2017 / 04:09
1
answer

Saves browser state or cookies using selenium

I am doing tests using whatsapp web, so every time I run selenium, I read the qr code and start the tests, and I have to do this every time, I would like to know if there is a way to save the browser state, save session, some way to start the br...
asked by 28.09.2017 / 22:59
1
answer

Error in Python2

I'm practicing using Python 2, but I do not know the reason for this error. Below is my code with the error. And numpy and scipy are installed, because when I give the import no more error appears. vaca1= [1,1,0] vaca2= [1,1,0] v...
asked by 15.09.2017 / 04:43