Questions tagged as 'python-3.x'

1
answer

Problems importing cx_oracle in python 3.4 64 bits

I have a problem with cx_oracle in python 64 bit. I installed this version of cx_oracle: cx_Oracle-5.2.1-11g.win-amd64-py3.4. But when importing in python import cx_Oracle , the following error occurs: Traceback (most recent call last):...
asked by 24.05.2016 / 20:03
2
answers

Decoding of file in Python

I have a file that is completely written so after my crawler also written in Python I have saved the data in it: b'N\xc3\xa3o n\xc3\xa3o n\xc3\xa3o, n\xc3\xb3s iremos sim!' I wonder if there is any way I can get the encoding out of th...
asked by 21.04.2016 / 00:00
2
answers

Problem connecting MySQL in Python 3.4

I just installed my virtual environment, I installed PyMysql and created a project, but when trying to start a python manage.py startapp nome APP, the following problem occurred: Error loading MySQLdb module: No module named 'MySQLdb'...
asked by 29.09.2015 / 04:37
1
answer

Import module from another folder

I want to import a module that is in a folder that is the sister of the folder where I have the script, in which I want to import the other script, that is: logic\ board.py' mlogic.py player.py gui\ mgui.py logic and...
asked by 27.11.2014 / 18:52
1
answer

Error importing xml.parsers.expat in Python 2.7 only works with Python3

Good morning, a few months ago started with python I'm using it to do tests in android applications. I have the following problem importing xml.parsers.expat . when I run directly on the terminal it works. More if I run using subprocess...
asked by 28.12.2015 / 14:44
2
answers

Printing specific lines from a text file

Imagine that I have a text file called test.txt with the following content: 4 Março 2017- Sábado meu aniversario -prova de calculo 6 Março 2017- Segunda aniversario do Salomao - fazer compras 8 Março 2017- Qu...
asked by 12.03.2017 / 02:46
2
answers

How to read hyphen-separated numbers in a text file?

Let's say I have a text file where its configuration is: 1-2-3-4-5-6-7-8-9-10-11-12-13-14-15-16-17-18-19-20...-999 How do I read the file and save each number of the one that is separated by - ?     
asked by 23.11.2017 / 18:31
2
answers

I understand a parallel execution using fork. How does the fork work?

import os def filho(): print('Ola do filho', os.getpid()) os._exit(0) def pai(): while True: newpid = os.fork()# fornece ID para um novo processo! if newpid == 0: filho() else: print('...
asked by 07.04.2018 / 18:08
3
answers

How do I block access to parameter creation in a class?

import math class Circulo(): def __init__(self): super() self.__raio = None def get_perimetro(self): return 2 * math.pi * self.raio def get_area(self): return math.pi * self.raio ** 2 @property...
asked by 17.07.2017 / 05:40
2
answers

Why the comparison of a variable with None must be done using is or is not

I'm using PyCharm as an IDE to create my programs in Python , and at some point I had to make a comparison between a value of a variable and None , and I tried with the following code: if file == None: print("Nothing opened"...
asked by 23.09.2014 / 23:25