Questions tagged as 'python-3.x'

1
answer

Check if subdomain exists with Python 3

I want to check if a subdomain present on a website exists. I tried to use urllib.request.urlopen() but it returns the status code as 200 even if it does not exist. This is because my provider returns a page indicating that DNS does not e...
asked by 13.03.2017 / 00:02
1
answer

Web Scraping - convert HTML table into python dict

I'm trying to turn an HTML table into dict @ python, I came across some problems and I ask for help from you. Follow it as far as I could get ... def impl12(url='http://www.geonames.org/countries/', tmout=2): import requests from bs...
asked by 01.08.2017 / 16:59
1
answer

a bug in the range () function?

I've been writing a function for a class that takes a dictionary and converts it to a string to represent an array. def __str__(self): grid_str = ['' for _ in range(self.heigth)] for y in range(self.heigth): for x in range(s...
asked by 25.01.2017 / 12:47
2
answers

NameError: name 'input' is not defined [closed]

I do not understand the error in this code ... def checkio(number): #Your code here #It's main function. Don't remove this function #It's using for auto-testing and must return a result for check. number = int(input("Escolha u...
asked by 05.12.2016 / 21:18
2
answers

How do I delete a file from a folder in python

The code below lists the files of a certain directory, I wanted to know how do I delete only 1 file from this directory def etc(): path ="diretorio"' dir = os.listdir(path) for file in dirs: print(file)     
asked by 28.04.2017 / 04:01
1
answer

Why does this instance variable never assume False value?

When running the following code, the variable _order_stability never gets False, even when I try to force it during the debug. The variable can assume other values, for example of type int that are different from 0 and 1. Whe...
asked by 25.10.2016 / 02:57
1
answer

Error in CSS - Django FormField

I'm giving the following error in my Django 1.9 form Notice that the label has the :> at the end. I DO NOT WANT THE GREATEST SIGN (>) AT THE END OF LABEL Ex: Nome: > Followmycodeforms.pyclassFormContact(forms.Form...
asked by 17.02.2016 / 02:04
1
answer

How to delete items in an array? (Python 3)

I need to build a program where the user might delete events from event programming, but the problem here is that when it deletes another event, I say, after having deleted the first one (a sublist / number indicated there next to the name), the...
asked by 25.11.2018 / 20:06
1
answer

Date validation consisting of three integers in Django

In my application I am getting the day, month and year from the user, the three fields are part of a form and are IntegerField . I do not want to use DateField because the user has the options to inform: Year; Year and month...
asked by 22.11.2018 / 11:38
1
answer

Calculate the number of even numbers in a tuple recursively

I need help to create a recursive function that finds and adds the even elements of a tuple, I would greatly appreciate the help. def conta_pares(t): '''conta_pares : tuplo -> inteiro recebe tuplo de inteiros e devolve o numero de ele...
asked by 17.12.2018 / 16:32