Questions tagged as 'python'

1
answer

Doubts about PEP8 [duplicate]

I read the PEP8 but I did not quite understand it when using 2 blanks. Should I use 2 spaces to separate a section of imports from another section? What sections does a Python file typically have? Should I have a file with all...
asked by 01.11.2017 / 13:12
1
answer

How to remove null, false, and true Json file values?

I have a JSON file with this data: { "in_reply_to_screen_name": null, "favorited": false, "id_str": "92", "entities": { "user_mentions": [], "symbols": [], "urls": [], "hashtags": [ {...
asked by 31.10.2017 / 19:50
2
answers

Doubt about KeyPress in Pygame

I have a question regarding Pygame. I'm starting to fiddle and I found a problem here. When I press the A (left) button, I move the image to the left, until everything is ok. But if you keep the key pressed it does not repeat the movement. I...
asked by 03.11.2017 / 18:25
1
answer

How to transform a text in identifier name?

I would like to be able to receive a string as a parameter and use it as the identifier name, to create a variable or function with that name (not to use as a dictionary key). Is it possible to do this?     
asked by 03.11.2017 / 12:20
1
answer

How to insert only elements that do not exist?

I have a python script that looks for elements of one database and saves it in another, so when I run the script it is duplicating the data. sql = "INSERT INTO 'alarm' ('data', 'seconds', 'culprit', 'status') VALUES (%s, %s, %s, %s) Is ther...
asked by 30.10.2017 / 15:48
1
answer

How to count the number of rows in a table in python

Example, I have a database called 123, in this database has the players table, which would be where the players' accounts are. I want to count how many accounts there are in the database. Finally, count the number of rows in a SQLITE3 table,...
asked by 12.10.2017 / 03:27
3
answers

Read 10 integers and get the largest number between them

Using a function, make a program that reads 10 integers and print the largest of them on the screen. For equal values, print any of the larger values. If the largest number is multiple of the first number n read, print n on the scr...
asked by 29.09.2017 / 15:01
1
answer

I can not return the values assigned to the variables

I'm a layman and I'm programming and starting a python program to use as a tool in a game well, the code so far is this: def tempo (temp): total=temp*quant dias=total//(24*60*60) var1=total-(dias*(24*60*60)) horas=var1//(60*60) var2=var1-(hora...
asked by 23.01.2018 / 21:18
1
answer

How to open, read the file and save in a list of lists the contents of the file using Python

I have a list with file.txt paths With the read () function, I can save the entire contents of the file into a list where each word is stored in a list position. But since I intend to read 3 files at once and save the contents of each file...
asked by 06.10.2017 / 06:33
1
answer

Add spaces to the end of the field - python

Hello, everyone. I have a * .txt file in which there is a column with the product code and another column with the quantity value as below: Cód. qtd 7513020087041;5.0 879705341017;24.0 11713777;8.0 17565097;2.0 181420;20.0 181...
asked by 11.01.2018 / 19:45