Questions tagged as 'python-3.x'

1
answer

Problem when using the function .join ()

What's the problem with my code, I used the .split () function to separate the string when it finds'; ', after separating I wanted to join to come back putting spaces so I used the .join (), however I did not see effects see: #Irá separar cada...
asked by 03.08.2017 / 06:26
1
answer

Reading an XML file and printing specific fields using the Python language

I have the following XML file (actually it's just a piece of the file): <!DOCTYPE sysstat PUBLIC "DTD v2.19 sysstat //EN" "http://pagesperso-orange.fr/sebastien.godard/sysstat-2.19.dtd"> <sysstat> <sy...
asked by 02.08.2017 / 02:01
1
answer

Import in Python

How do I import into Python being this class created by me? Example: in java I create a connection class and I can make the amount of it in the stock class to be able to do the persistence in the bank, but I do not know how to do this in Pyth...
asked by 23.08.2017 / 02:06
1
answer

emoji in PyCharm

I'm using pycharm, I've already downloaded the emoji module, and still this message appears: Traceback (most recent call last): File "C:/Users/Aspire/Desktop/curso-de-py-gua/aula08.modulos/ex.gua/emoji.py", line 1, in <module> impo...
asked by 25.10.2017 / 22:48
1
answer

How to accept a list as input?

This is an exercise in a USP course. I will post the statement and the code so that the doubt is clear. Write the remove_repetitions function that receives a list of integers as a parameter, checks to see if it has repeating elements and rem...
asked by 07.08.2017 / 21:04
1
answer

Format & End in print in Python

I am creating an application that connects to the Sqlite db, search and return the column of the table in question, the problem is that the result returned unformatted looks like this: ( u'Field 1, Field 2' ) , to print I tried to use...
asked by 01.07.2017 / 18:00
1
answer

Create tuples of dataframe generated by Pandas

Is it possible to generate a tuple that stores the row values of a dataframe generated by pandas? I uploaded the values from a CSV file to a dataframe, now I need to perform some calculations with these values, but I have not found any tips on t...
asked by 27.04.2017 / 21:27
1
answer

How to clean the screen of the Windows Python interpreter?

I'm starting to study Python (version 3) by doing several syntax tests using the interpreter for Windows. However, I would like to wipe from the screen the commands I have already executed, as the scroll bar grows. I tried typing clear ,...
asked by 27.04.2017 / 19:33
3
answers

read text file and generate lists for each line with element separation

   In python, I have for example the following lines in a text file: 1, julian, 0.5,6,7,8,9 2, ana, 01,9,5,6,8,1 and wanted to generate lists: list1 = [1, 'julian', 0.5,6,7,8,9] list2 = [2, 'ana', 01,9,5,6,8,1]    Citation bec...
asked by 05.06.2017 / 05:32
1
answer

TypeError: POST data should be bytes, an iterable of bytes, or a file object. It can not be of type str

I'm trying to translate a code from Python 2.7 to 3.6 Code 2.7 works perfectly: from urllib2 import Request, urlopen values = """ { "exchange_code": "PLNX", "exchange_market": "BTC/USDT" } """ headers = { 'Content-Type': 'ap...
asked by 21.03.2017 / 00:23