Questions tagged as 'python-3.x'

1
answer

How to concatenate a variable to a string that contains escape character

I'm new to Python, and am trying to set up a socket server for exchanging messages (like a telnet) for communication with a client. The problem I am facing is that this client has its own protocol, and I need to have the server send the messages...
asked by 13.05.2018 / 11:58
1
answer

Python - Complete list of each writer, along with the acronym of each person (first letter of name and surname)

Based on the list of writers described below, I have to manually create a list where each element is a list of two elements, name and nickname . Here's the list: escritores = [['Pedro', 'Tamen'], ['Almeida', 'Garrett'], ['Camilo', 'Pessa...
asked by 02.05.2018 / 15:21
1
answer

How to print only the first column of a dataset with numpy?

How to print only the first column of a dataset with numpy? My code: import numpy as np data = np.genfromtxt("iris.data",delimiter = ",",usecols=(0,1,2,3)) print(data) My dataset (part of it): 5.1,3.5,1.4,0.2,Iris-setosa 4.9,3.0,1.4,0...
asked by 30.04.2018 / 14:43
1
answer

Assign text in TXT file to a variable

Good morning! I'm running a project that is working normally but would like to automate it more to gain time in the operation. In case my project takes a text file the main words that I have described inside the "text" variable and put it t...
asked by 25.04.2018 / 15:51
1
answer

Code is jumping lines - Python

Good afternoon! I would like some help in my project that looks for words (file: Variables.txt) within another (Answers.txt) file and makes the markup Find a word. But by jumping some sentences leaving the final text (Result.txt) blank....
asked by 26.04.2018 / 20:15
1
answer

Python Library

Is there a place where I can query Python commands and functions in Portuguese? Eg If I want to know about a command or module like numpy or pandas? I noticed that a lot of the information is in English, for example if I give a help ('prin...
asked by 28.03.2018 / 18:40
1
answer

Condition with letter in Python

I want to be a simple example of: test = input('Letra: ') If the letter you typed is 'a' (here I have a problem) print('exemplo') I want you to see a message when you type "a" ..........     
asked by 23.04.2018 / 21:44
1
answer

Plotting .xls file with matplotlib and openpyxl

Having the following content in my .xls file:    Belo Horizonte - MG 2278.8       Porto Alegre - RS 1647.8       Recife - PE 2434.9       Rio de Janeiro - RJ 1653.6       Salvador - BA 2324.1       São Paulo - SP 2227.5       Total of a...
asked by 10.03.2018 / 20:10
2
answers

Problem with importing files into diferenter directories

I have a problem with using different files in different directories, this is the directory tree of my project: DeatHash ├── deathash │   ├── deathash.py │   ├── dictionaries │   │   ├── dictionary_test.txt │   │   └── dictionary.txt │   ├── f...
asked by 09.03.2018 / 22:40
1
answer

What is the correct way to do the template in Django / python?

This has been my first contact with the framework and with mvc / mvt, and I am in doubt, in terms of good practices and tals, should I make a template for each of the views or should I just make a template and change the template content dynamic...
asked by 16.03.2018 / 18:14