Questions tagged as 'python'

1
answer

Concatenate arrays using numpy module

For the solution of linear systems: how to concatenate an array A, an array (vector column) b, so that we have the "augmented" matrix of the system, A ~ = [A b] , using numpy?     
asked by 30.11.2016 / 02:38
1
answer

NameError: name [name] is not defined

I need to do a Python programming to know the CG percentage in a DNA strand ... maior = 0 dnaMaior = "" while True: dna = input("Digite uma sequencia de DNA: ") if dna == "Z" or dna == "z": break else: tam = len(dn...
asked by 05.10.2016 / 00:31
1
answer

Why is this server crashing?

from socket import* Host = "localhost" Port = 255 sockobj = socket(AF_INET, SOCK_STREAM) sockobj.bind((Host, Port)) sockobj.listen(5) while True: conexão, endereço = sockobj.accept() print('Server conectado por', endereço) while Tru...
asked by 06.01.2017 / 15:25
1
answer

How to create a sub array from an array in Python?

I was able to generate an array via Python and through this generated array I had to generate a 3x3 array. But I do not know how to do this, I was researching and I know that Python itself has a resource for this, but I do not think so. Examp...
asked by 11.02.2017 / 02:10
2
answers

Handling Network Settings in Python

I work in linux environment, Python 2.7, and am needing a Python module / library that allows me to change the network settings (IP, Subnet, Gateway and, if possible, primary and secondary DNS). I checked some libraries ( netaddr , i...
asked by 08.02.2017 / 02:14
1
answer

How to get the headlines for the Olympics on CNN's website using Python using BeautifulSoup?

I would like an example of how to get the headlines for the Olympics at link Using BeautifulSoup.     
asked by 07.08.2016 / 16:07
2
answers

Looping for as looping parameter while

Since the list cont would have the values: cont = ['t','f','f','t','f'] You could do something like this: while(for cont in cont == 'f'): pass     
asked by 26.07.2016 / 14:30
1
answer

Print a list of objects as a string in Python

I'm doing a program in python (2.7) where I get infos of a file, and storing it as objects in a list, I'd like to print the list but only return the addresses, I'm learning to program in python and no answer What a find for that serves me. How c...
asked by 28.07.2016 / 22:00
1
answer

Sockets - Old Game / Rooster Game MULTIPLAYER

EDITED POST I'm creating the so-called 'Game of the Old Man' (or 'Game of the Rooster'), at this time I'm trying to create a feature that allows two players on different devices - albeit on the same network - to play against each other ....
asked by 26.11.2016 / 23:12
1
answer

Keep variable value in a python function

Within a function I have a cumulative variable, and I call this function over and over, the problem that it loses values every time it enters. Summarizing what I want to do is: def teste(a): a=a+1 c=7 print a return c def main():...
asked by 09.06.2016 / 22:24