Questions tagged as 'python-3.x'

1
answer

Search for nested list elements

I have a problem with a code. I have to find a specific element (I know which element it is but I do not know its position because it is random). Under normal conditions, I would use a index and would easily get the position. The problem...
asked by 19.03.2015 / 19:17
1
answer

Creating a chat program. How to make two converse simultaneously?

# -*- coding: utf-8 -*- #!/usr/bin/python3 import socket # nao tem servidor UDP no google -> vamos usar netcat como servidor UDP! #Programa de chat: so fala um de cada vez #implementar falando ao mesmo tempo client = socket.socket(socket.AF_I...
asked by 16.08.2016 / 00:07
1
answer

Difficulty with def and regex

I have the following list: support;auteur;titre;nombre_de_prets Bande dessinée jeunesse;Saint-Mars, Dominique de;Max et Lili ont volé des bonbons [Texte imprimé];1095 Livre jeunesse;Saint-Mars, Dominique de;Lili est stressée par la rentrée;10...
asked by 07.12.2016 / 10:13
1
answer

How to accent in Python

I'm writing a program and it gets giving ascii error. I've already put this on the first line and nothing: # -*- coding: utf-8 -*- On request, it follows edition explaining what is now. now it is variable for datetime and I believe it...
asked by 20.05.2015 / 01:43
2
answers

How to clone a list with Python 3?

From list m : m = [[' # ', ' # ', ' # ', ' # ', ' # ', ' # '], [' # ', ' # ', ' # ', ' # ', ' # ', ' # '], [' # ', ' # ', ' # ', ' # ', ' # ', ' # '], [' # ', ' # ', ' # ', ' # ', ' # ', ' # '], [' # ', ' # ', ' # ', ' # ', ' # ', ' #...
asked by 28.08.2018 / 19:54
1
answer

Differences between __name__ and __qualname__

In Python functions / methods and classes have two attributes that in their most basic use seem to do exactly the same thing, they are: __name__ and __qualname__ , see: def fn(): pass class C(object): pass >>>...
asked by 28.10.2018 / 02:39
1
answer

Why this function shows the list before returning but returns None

I'm writing a function that capitalizes all the string elements of a list recursively, but it returns "strangely" None, but before returning it correctly lists the capitalized list: def cap_str_elems_r(ls=[], new_list=[]): if len(ls)>0:...
asked by 09.11.2014 / 21:55
1
answer

classification_report and sklearn confusion_matrix: values do not match?

Model: logistic regression with sklearn. I decided to compare the results shown in the classification_report, calculating them using the confusion matrix but apparently the results do not match: classification_report: precision recall...
asked by 24.06.2018 / 19:19
3
answers

Number of numbers greater than 7 in a list in Python

I want to know how many numbers are greater than 7 in the 'a' list.    Note: I'm using slicing because in the case I'm putting in   practice, I do not know how many items you have on the list. a=[5, 10, 6, 8] qmaior= a.count([:-1])>7...
asked by 05.11.2017 / 04:21
1
answer

Python - QDate to datetime conversion

I need to convert a date input by a QCalendar to datetime (from the datetime lib). How can I do it?     
asked by 24.07.2017 / 19:39